Pretty print JSON in your terminal
Sometimes you have the need to pretty print some JSON you are looking at in your terminal. Much like what xmllint --format does for XML.
With python around it is very easy. Just use python -mjson.tool:
echo '{"foo": "lorem", "bar": "ipsum"}' | python -mjson.tool
outputs:
{
"bar": "ipsum",
"foo": "lorem"
}
Written by Christian Lizell
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#