Skip to content

Instantly share code, notes, and snippets.

@iketiunn
Created April 7, 2022 01:57
Show Gist options
  • Save iketiunn/93f8ef74648189572a1953ac1faf0938 to your computer and use it in GitHub Desktop.
Save iketiunn/93f8ef74648189572a1953ac1faf0938 to your computer and use it in GitHub Desktop.
pipe stdin json to beautify by evaluating script with node
# 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))"
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