help make a Command to show 1 crypto price

the command is $(urlfetch json https://api.coingecko.com/api/v3/simple/price?ids=Ergo&vs_currencies=USD)

It returns {“ergo”:{“usd”:2.28}}, I only want to show 2.28(the price) how can I fetch the data?

Hey @xheimskr!

It couldn’t be easier! With JSON you move up the keys tree using dots.

So you do it like this:

$(eval e=$(urlfetch json https://api.coingecko.com/api/v3/simple/price?ids=Ergo&vs_currencies=USD).ergo.usd)

Similar topics:


@Jota this API has Shibacoin under “Shiba-inu

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.