Last Updated: February 25, 2016
·
1.278K
· groodt

Pretty-print JSON output from a web service

An easy way to pretty-print JSON from a web service call, is to pipe it through the json.tool Python module.

curl https://coderwall.com/groodt.json | python -m json.tool

This can also be used for files on disk or any application that outputs JSON.

cat file.json | python -m json.tool

I've created a script on my path called 'pretty-json' so that I don't need to remember the exact Python module.

This module is only available with Python 2.6 and above.