Reputation: 1023
should be a simple one but I can't find an answer..
I am console logging some parsed Json but it only shows one level and does not show the deeper objects in the log..
{ jsonrpc: '2.0',
result:
[ { marketId: '1.118750017',
marketName: 'Match Odds',
marketStartTime: '2015-05-12T15:30:00.000Z',
totalMatched: 52.32,
runners: [Object],
eventType: [Object],
competition: [Object],
event: [Object] } ],
id: 1 }
How do I log and expand on the items showing as objects above. I know they exist but can't print them out to the screen.
code is simply;
var response = JSON.parse(str);
console.log(response);
If I console log str I get all the data in a not very readable format.
Thanks
Upvotes: 1
Views: 98
Reputation: 1869
Try using the util.inspect method with these options:
var util = require('util');
console.log(util.inspect(response, {showHidden: false, depth: null}));
Upvotes: 2