Basic console.log will not go through long and complex objects, and may decide to just print [Object] instead.
Two of the suitable ways to print the object with nested properties are exemplified below:


util.inspect(object[, options])
const util = require('util'),
const obj = {} // some complex object

console.log(util.inspect(obj, {depth: null}));

//{ depth: null } instructs util.inspect to open everything until it gets to a circular reference

//There are other options also available, such as showHidden, colors, maxStringLength, maxArrayLength, sorted, etc.



JSON.stringify(value, replacer, space)
const obj = {}

console.log(JSON.stringify(obj, null, "\t"));

// "/t" would format the output with a tab in each line of property output


Support On Demand!