Created
April 15, 2015 10:20
-
-
Save mroderick/2e00572af6a01e225fce to your computer and use it in GitHub Desktop.
Readable output from JSON.stringify
This file contains 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 o = {hello:'world', greetings: ['one', 'two', 'three']}; | |
undefined | |
// regular, difficult to read for large objects | |
JSON.stringify(o); | |
"{"hello":"world","greetings":["one","two","three"]}" | |
// presto! | |
JSON.stringify(o, '', ' '); | |
"{ | |
"hello": "world", | |
"greetings": [ | |
"one", | |
"two", | |
"three" | |
] | |
}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment