Platform Currency Swapped with Price Column

Hello @nrg

For some reason the currencies ticker result for page two is acting weird. Somehow the platform currency column is in front of the price column. This messes up my formulas, any ideas? Only happens for page 2. Page 1 and 3 are fine.

These would be the queries…

=ImportJSON(“https://api.nomics.com/v1/currencies/ticker?key=MY_KEY&currency=EUR&interval=1d,7d,30d,365d,ytd&per-page=100&page=1”)

=ImportJSON(“https://api.nomics.com/v1/currencies/ticker?key=MY_KEY&currency=EUR&interval=1d,7d,30d,365d,ytd&per-page=100&page=2”)

Didn’t check the JSON results themselves but I hope it’s not the importJSON() function.

Cheers!

JSON responses are key:value and not ordered. You cannot rely on order in JSON parsing. Converting JSON to CSV should understand all fields involved and place them in a reliable order. You’ll need to improve the importJSON function to account for fields being present or not, and not having reliable order.

This is what I was referring to when I said that CSV conversion of large nested JSON data responses is complex.

Yes, I figured as much. Thanks. I’ve converted to importing and tidying data, writing to .csv and then writing the .csv to Google Sheets with R scripts.

If I ever get round to adapting the Google Apps Script I’ll redistribute it here.

Cheers