UPDATE: entry.content.$t
is actually not the correct field to access individual cells. The proper method is using entry.gsx$[cell column header]. Thank you for pointing out this mistake and assisting in finding a solution.
Initial inquiry:
I am currently attempting to analyze JSON data from a Google Spreadsheet. The issue at hand is that the entries field provides a string representing an entire row of the spreadsheet, but it seems malformed as an object. How have others managed to parse this data? Below is an example of what the content node resembles:
"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"
},
Upon closer inspection, the $t
field yields a complete string representing a row in the Google spreadsheet. Therefore, entry.content.$t
delivers a string like:
location: 780 Valencia St San Francisco, CA 94110, phonenumber: (555) 555-5555...
Another complicating factor is that certain cells within the spreadsheet contain commas (such as addresses) that are not properly escaped or enclosed in quotes. This means that something similar to
jQuery.parseJSON(entry.content.$t)
or
eval('('+ entry.content.$t + ')')
results in an error. While regex might be an option, I am hopeful that there could be a more refined solution employed by others. Your assistance is greatly appreciated!