I try to retrieve data only on the body object, and I am confused by this section
My code
coin_price: async function(callback){
var coingecko = await CoinGeckoClient.simple.price({
ids: config.tickercoins,
vs_currencies: ['usd', 'btc', 'idr', 'eur', 'jpy', 'krw'],
});
callback(null, coingecko);
},
Result:
"coin_price": {
"success": true,
"message": "OK",
"code": 200,
"data": {
"loki-network": {
"usd": 0.202249,
"btc": 0.000055,
"idr": 2905.52,
"eur": 0.176356,
"jpy": 22.18,
"krw": 225.42
}}},
And I want to be like this:
"coin_price": {
"usd": 0.202249,
"btc": 0.000055,
"idr": 2905.52,
"eur": 0.176356,
"jpy": 22.18,
"krw": 225.42
},
And I tried to edit my code like:
coin_price: async function(callback){
var coingecko = await CoinGeckoClient.simple.price({
ids: config.tickercoins,
vs_currencies: ['usd', 'btc', 'idr', 'eur', 'jpy', 'krw'],
});
callback(null, coingecko.data);
},
And result:
"coin_price": {
"loki-network": {
"usd": 0.202249,
"btc": 0.000055,
"idr": 2905.52,
"eur": 0.176356,
"jpy": 22.18,
"krw": 225.42
}},
The code: callback(null, coingecko.data[0]); does not work
Is there an example so the results can be as I want?
coingecko.data['loki-network']