Pretty Print any JSON from the CLI
Using python, either pipe in json or pass in a filename to
python -mjson.tool
For instance
% cat foo.json
{"something":"needs formatting","really badly":1}
% cat foo.json | python -mjson.tool
{
"really badly": 1,
"something": "needs formatting"
}
% python -mjson.tool foo.json
{
"really badly": 1,
"something": "needs formatting"
}
Written by Jason Whaley
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#