I am trying to get the values of item, but when I print the values in the console it displays object instead of the values. How can I access the values?
Here is my code:
var options2;
request.post(opts,function(error,response,body){
if (!error && response.statusCode == 200 || response.statusCode == 201) {
var jsonResponse = JSON.parse(body);
console.log("JSON IS =" + jsonResponse.rows);
options2 = jsonResponse.rows.reduce((acc, obj) => acc.concat(obj['Item']), []);
}else{
console.log(body)
}
});
What do I miss?
{ "columns" : [ "Items" ], "rows" : [ { "Item" : "ABC" }, { "Item" : "DEF" } ]) looks like a object you don't have to parse it again.