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.
Written by Greg Roodt
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#