How to manipulate json data before display
-
I am using a cryptocurrency api to receive price in Pound Sterling (£).
the price I receive is 0.2661740645901306. I would like to display this price with two decimal points. e.g. 0.26.
This is my code so far, how do I edit it to remove the unnecessary digits?
[jsoncontentimporter url=”https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?CMC_PRO_API_KEY=APIKEYGOESHERE&symbol=BAT&convert=GBP” basenode=data]
{subloop:BAT:-1}
{subloop:BAT.quote:-1}
{subloop:BAT.quote.GBP:-1}
{BAT.quote.GBP.price}
{/subloop:BAT.quote.GBP}
{/subloop:BAT.quote}
{/subloop:BAT}[/jsoncontentimporter]Visit here for free api key if you want to sewe the JSON – https://coinmarketcap.com/api/
- The topic ‘How to manipulate json data before display’ is closed to new replies.