EDIT: entry.content.$t
is not a entry.content.$t
field for accessing individual cells. entry.gsx $ [cell column header] is the correct method. Apologies and thanks for the help in resolving this issue.
The original question:
I am trying to parse JSON data from a Google spreadsheet . The problem is that the record field returns a row that is an entire row of the table but looks like a distorted object. How do other people analyze this data? Here's what the contents of node look like:
"content": { "type" :"text", "$t" :"location: 780 Valencia St San Francisco, CA 94110, phonenumber: (555) 555-5555, website: http://www.780cafe.com, latitude: 37.760505, longitude: -122.421447" },
Look carefully, the $t
field returns a whole row, which is a row in a Google spreadsheet. So entry.content.$t
returns the string: location: 780 Valencia St San Francisco, CA 94110, phonenumber: (555) 555-5555...
A further exacerbation of this problem is that some cells in the spreadsheet have commas (for example, addresses) that are not escaped or quoted. Sort of
jQuery.parseJSON(entry.content.$t)
or
eval('('+ entry.content.$t + ')')
causes an error. I believe regex is an option, but I hope others may have solved it more elegantly. Thanks for the help!
source share