0
I have a request that returns the following:
object
{ responseHeader:
{ status: 0,
QTime: 0,
response:
{ numFound: 22,
start: 0,
docs:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ] },
}
I wonder how I can access the attributes of each object at a time, my code so far is as follows:
var request = require('request');
request('request link', function (error, response, body) {
console.log('error:', error);
console.log('statusCode:', response && response.statusCode);
var body = JSON.parse(body);
console.log(typeof(body));
console.log(body);
var stringfied = JSON.stringify(body, null, 2);
console.log(stringfied);
});