Reputation: 71
im trying to read json data and get the price of ETC. The problem is that the path to get the price in usd has a "-" in the ethereum-classic name and im getting errors.
url = "https://api.coingecko.com/api/v3/simple/price?ids=ethereum-classic&vs_currencies=usd";
request(url, (err, res, body) => {
const data = JSON.parse(body);
const item = data.ethereum-classic.usd;
Upvotes: 0
Views: 36
Reputation: 112
Did you try something like this ?
const item = data["ethereum-classic"].usd
Upvotes: 1