Last active
March 7, 2019 13:03
-
-
Save horttanainen/110b248408d39a57d5d371919dc9faa0 to your computer and use it in GitHub Desktop.
Pretty print JSON without jq using 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
#!/usr/bin/env bash | |
node -e 'var fs = require("fs"); process.stdin.resume(); process.stdin.setEncoding("utf8"); var data = ""; process.stdin.on("data", function(buf) { data += buf; }); process.stdin.on("end", function() { 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
Add the snippet in your .bashrc
Try it out: