Created
February 26, 2015 21:30
-
-
Save bq1990/8b0e0c4fb9ae0b9f34e3 to your computer and use it in GitHub Desktop.
Javascript pretty json
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
function prettyJSON(obj) { | |
console.log(JSON.stringify(obj, null, 2)); | |
} | |
// obj -> value to convert to a JSON string | |
// null -> (do nothing) | |
// 2 -> 2 spaces per indent level |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment