Welcome, guest | Sign In | My Account | Store | Cart

Simple script to be used as a shell pipeline to pretty print JSON output. Quite useful when using couchdb with curl.

This is a shell function which uses Python to do all ork.

Python, 3 lines
1
2
3
pjson () {
        python -c "import json; import sys; print json.dumps(json.loads(sys.stdin.read()), sort_keys = True, indent = 2)"
}

You can use it like this

curl http://localhost:5984/admin/_design/cases/_view/all\?include_docs=true | pjson | less