Skip to content

Instantly share code, notes, and snippets.

@cakesmith
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save cakesmith/8c6de241bb912ff87b0e to your computer and use it in GitHub Desktop.

Select an option

Save cakesmith/8c6de241bb912ff87b0e to your computer and use it in GitHub Desktop.
How to console.log() a deep object in Node.js
var myObject = {
"a":"a",
"b":{
"c":"c",
"d":{
"e":"e",
"f":{
"g":"g",
"h":{
"i":"i"
}
}
}
}
};
var util = require('util');
console.log(util.inspect(myObject, {showHidden: false, depth: null}));
# Outputs: { a: 'a', b: { c: 'c', d: { e: 'e', f: { g: 'g', h: { i: 'i' } } } } }
# alternative shortcut
console.log(util.inspect(myObject, false, null));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment