I am stuck. It seems that this should be working, but it is not.
I am trying to access an object's key values, but it is not working. I've done this before and have read plenty of things here on stack overflow and elsewhere, but it still does not work.
Here is my code:
var validate = UrlFetchApp.fetch(url, options);
Logger.log('validate = ' + validate);
Logger.log("validate['response'] = " + validate["response"]);
Logger.log('validate.response = ' + validate.response);
Logger.log("validate.['done'] = " + validate["done"]);
Logger.log("validate.done = " + validate.done);
var validateObj = JSON.stringify(JSON.parse(validate));
Logger.log("validateObj = " + validateObj);
Logger.log("validateObj.response = " + validateObj.response);
Logger.log("validateObj.done = " + validateObj.done);
and here are the logs:
validate = {
"done": true,
"response": {
"@type": "type.googleapis.com/google.apps.script.v1.ExecutionResponse",
"result": "Invalid Full Name. Please enter a valid Full Name."
}
}
validate['response'] = undefined
validate.response = undefined
validate.['done'] = undefined
validate.done = undefined
validateObj = {"done":true,"response":{"@type":"type.googleapis.com/google.apps.script.v1.ExecutionResponse","result":"Invalid Full Name. Please enter a valid Full Name."}}
validateObj.response = undefined
validateObj.done = undefined
When using bracket notation, I've tried using single and double quotes as well.
Can anyone help me to see the error?