JSON object array return undefined
I guess the result your getting from your API as e.postData.contents
is a JSON string.
In this case something like this:
var msg = JSON.parse(JSON.stringify(e.postData.contents));
would first try to turn something into a JSON string (JSON.stringify
) and then converting it into a JavaScript object by JSON.parse
. In other words the JSON.stringify is useless.
Try this instead:
var msg = JSON.parse(e.postData.contents);