1
var jsonJSON = UrlFetchApp.fetch("https://wowtoken.info/snapshot.json");
var json = Utilities.jsonParse(jsonJSON.getContentText());

var max24 = json.NA.formatted.24max;

I'm sure my code is sloppy but, I'm getting "Missing ; before statement." from the bottom line. It goes away when I remove the '24', but the source itself has '24max'.

Is there a way to have javascript ignore the 24 after the period? Or are the top two lines of code wrong?

3infimyst
  • 13
  • 2

1 Answers1

2

Instead of removing the numbers in front of the object names during parsing, you can also access the object's property like you would access an array element like so.

json.NA.formatted["24max"]

JavaScript variables must begin with a letter, $ or _. That is the reason why you are getting an error instead.

josephting
  • 2,617
  • 2
  • 30
  • 36