Last active
August 29, 2015 14:03
-
-
Save cakesmith/8c6de241bb912ff87b0e to your computer and use it in GitHub Desktop.
How to console.log() a deep object in Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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