Skip to content

Instantly share code, notes, and snippets.

@hynkle
Created October 1, 2012 20:25
Show Gist options
  • Select an option

  • Save hynkle/3814202 to your computer and use it in GitHub Desktop.

Select an option

Save hynkle/3814202 to your computer and use it in GitHub Desktop.
pretty-print JSON using node
function ppjson {
node -e "
require('fs').readFile(
'$1',
function(err,data) {
if (err) {
console.error(err);
process.exit(1);
}
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