I have a simple script that pulls about 30,000 characters of JSON.
I get SyntaxError: Unexpected token: F (line 12) when I try to parse it with JSON.parse() or Utilities.jsonParse();
function refresh() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
sheet.clear();
var text = UrlFetchApp.fetch("http://blablah/json");
Logger.log(text.getContentText());
//error SyntaxError: Unexpected token: F (line 12)
json = JSON.parse(text);
)
The logger only shows about 59 lines of the JSON, but I was told that the logger has a space limit - but I'm not so sure that's it.
Running on my own server, JSON.parse parses the data just fine and so does jQuery get().
So I'm thinking UrlFetchApp.fetch() just can't get long files?
Hard to accept and I've found no documentation about it :(
JSON.parseis recommended overUtilities.jsonParse. I don't remember the differences now, but a search on google forums should find it. - Henrique G. Abreu