Saturday, May 25, 2024
 Popular · Latest · Hot · Upcoming
53
rated 0 times [  56] [ 3]  / answers: 1 / hits: 51461  / 14 Years ago, sat, april 17, 2010, 12:00:00

I am pulling data from a web service and it is formatted as JSON. I am writing a Google Apps Script for Google Sheets that will populate the data for me. My problem is, I can't seem to get it to parse out.



Doing:



var dataset = myJSONtext;
Browser.msgbox(dataset.item[0].key);


errors out, saying:




item[0] is not defined.




Is there some built in way I should be doing this?


More From » json

 Answers
96

Apps script is (pretty much) just Javascript; plain-old JSON.parse is your best option for parsing JSON into an object representation.



You can also use JSON.stringify to serialize an object into a string representation.


[#97048] Wednesday, April 14, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elliem

Total Points: 415
Total Questions: 117
Total Answers: 94

Location: American Samoa
Member since Fri, Aug 26, 2022
2 Years ago
;