Monday, November 04, 2013

unix - How can I pretty-print JSON from the command line? - Stack Overflow

unix - How can I pretty-print JSON from the command line? - Stack Overflow: "From the Unix command-line with nodejs, specifying a filename that contains json, and using an indent of 4 spaces:

$ node -e "console.log(JSON.stringify(JSON.parse(require('fs') \
.readFileSync(process.argv[1])), null, 4));" filename.json"

'via Blog this'