Created
April 7, 2022 01:57
-
-
Save iketiunn/93f8ef74648189572a1953ac1faf0938 to your computer and use it in GitHub Desktop.
pipe stdin json to beautify by evaluating script with node
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
# 1 | |
echo "{a: 123, v: 546}" | xargs -I {} node -e "console.log(JSON.stringify({}, null, 2))" | |
# 2 | |
cat some.json | xargs -I {} node -e "console.log(JSON.stringify({}, null, 2))" |
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
xargs -I {} node -e "console.log(JSON.stringify({}, null, 2))" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment