2
votes

I'm trying to use Google Sheets as a JSON backend. The JSON output is here:

https://spreadsheets.google.com/feeds/list/15Vn0lMn_lIq3P_QKcJ2Obs65FvqbMEoxSPuj9qrQH98/od6/public/values?alt=json

This is the published spreadsheet: https://docs.google.com/spreadsheets/d/15Vn0lMn_lIq3P_QKcJ2Obs65FvqbMEoxSPuj9qrQH98/pubhtml

The problem is that the JSON output seems to be garbled. A sample line in the code is as follows:

 {"type":"text","$t":"day: Monday, menu: Paninis, baguettes, spaghetti / Chicken curry"}

I'm not getting the 'elegant and easily parse-able' JSON output.

What am I doing wrong?

1
Where did you get that JSON URL from? Looks like you might be using some internal JSON format, not the actual Google Sheets APISteve Bennett

1 Answers

2
votes

That's what the sheets output looks like using the url structure. You will want to look a little farther down to the gsx elements. That allows you to access the individual cell element rather than the combined elements.

You can get something more like this.

"gsx$day": {
"$t": "Tuesday"
},
"gsx$meal": {
"$t": "Lunch"
},
"gsx$menu": {
"$t": "Paninis, baguettes, spaghetti / Chicken curry"
}