Wednesday, June 20, 2018

console.log and console.dir showing partial representations of JSON hierarchies while just giving "Object" for deeply nested things

console.log might give you a string representation of an object but console.dir should show the whole tree right? Neither should work in a swallow let's-skim-the-surface way right? Alright this suggests this is specifically a trapping of logging things to the node console and has this fix:

const util = require('util');
console.log(util.inspect(myObject, {showHidden: false, depth: null}));

No comments:

Post a Comment