Unable to retrieve JSON data

I am trying access a Table located in DynamoDB. I have setup all the required sessions/permissions properly. I have also created all the required headers and the url accordingly. I am able to get the JSON when I am using the cURL command/Google’s Postman on my PC’s terminal.

But when I am trying the same on the Agent side of the IMP I am just getting this “2015-07-19 21:30:04 UTC-4 [Agent] (array : 0x7fa35c2d57a0)”. Below is the code that I am using to get the JSON data. My DataBase has a field called “record” and I am trying to access the data present in it.

local request = http.get(url, headers);
local response = request.sendsync();
local data = http.jsondecode(response.body);
server.log(data.record);

Kindly, help.

Thanks.

http.decode will decode the entire JSON string into an object hierarchy, including your “record” array. If you want to output the array with server.log, you’ll need to JSON encode it again.
local request = http.get(url, headers); local response = request.sendsync(); local data = http.jsondecode(response.body); server.log(http.jsonencode(data.record));

PS. it always pays to wrap http.jsondecode() in try…catch. You never know what you might get back from a server.