Created
September 25, 2018 06:37
-
-
Save harish2704/67824c25afdf12e018dc1d98211c9336 to your computer and use it in GitHub Desktop.
Pretty print / format JSON from STDIN using nodejs. single line solution.
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
node -e "console.log( JSON.stringify( JSON.parse(require('fs').readFileSync(0) ), null, 1 ))" | |
# Exapmle usage | |
# echo unformated.json | node -e "console.log( JSON.stringify( JSON.parse(require('fs').readFileSync(0) ), null, 1 ))" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment