Created
October 1, 2012 20:25
-
-
Save hynkle/3814202 to your computer and use it in GitHub Desktop.
pretty-print JSON using node
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 ppjson { | |
| node -e " | |
| require('fs').readFile( | |
| '$1', | |
| function(err,data) { | |
| if (err) { | |
| console.error(err); | |
| process.exit(1); | |
| } | |
| console.log( | |
| JSON.stringify( JSON.parse(data), null, 2 ) | |
| ); | |
| } | |
| ); | |
| " | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment