Google Apps Script : Returning "null" when trying to select a specific object in a API response but I can see it in the original response
From your question and script,
If the value of
This is the JSON data I receive back...in a pretty print visualized format.
is the value ofJSON.stringify(parsedData)
,parsedData.gram_in_mad
returns548.0454
.But if the value of
This is the JSON data I receive back...in a pretty print visualized format.
is the value ofparsedData
, I thought that in the case ofresponse
ofvar response = UrlFetchApp.fetch(url,params);
,parsedData
might be the string even whenvar parsedData = JSON.parse(response.getContentText());
is used.
So how about the following modification?
From:
var parsedData = JSON.parse(response.getContentText());
To:
var parsedData = JSON.parse(JSON.parse(response.getContentText()));