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?
Print in a new line like:
console.log("JSON IS =");
console.log(jsonResponse.rows);
Or replace '+' with a ',' like this,
console.log("JSON IS = ", jsonResponse.rows);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With