Skip to content

Instantly share code, notes, and snippets.

@lkptrzk
Created May 15, 2014 16:18
Show Gist options
  • Save lkptrzk/c32e95b0e3df078e2f8d to your computer and use it in GitHub Desktop.
Save lkptrzk/c32e95b0e3df078e2f8d to your computer and use it in GitHub Desktop.
pretty print json from stdin
#!/usr/bin/env node
var concat = require('concat-stream');
process.stdin.pipe(concat(function (data) {
var json = JSON.parse(data);
var str = JSON.stringify(json, null, 2);
console.log(str);
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment