I'm currently working through a Google Sheets Apps Scripts editor tutorial and I've reached module 4. Unfortunately, I've encountered an issue with the code I copied directly from the module. The error message I'm seeing is: SyntaxError: Unexpected token < in JSON at position 0. It seems like there may be an extra '<' character somewhere that needs to be removed, but I haven't been able to locate it through a search. I suspect the problem might be related to the responseText that JSON is fetching. The error is occurring specifically at line 94:
function fetchApiResourceObject_(url) {
// Make request to API and get response.
var response =
UrlFetchApp.fetch(url, {'muteHttpExceptions': true});
// Parse and return the response as a JSON object.
var json = response.getContentText();
var responseObject = JSON.parse(json);
return responseObject;
}
You can find the full code here:
Thank you.