Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
BaSH function to validate & pretty-print JSON from a file or stdin
function ppjson {
test -f "${1}" && src="open('${1}')" || src="sys.stdin"
python -c "import json,sys;sys.stdout.write(json.dumps(json.load(${src}),indent=2)+'\n')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment