Last Updated: September 03, 2020
·
597
· tylerhunt

Pretty-Print JSON from the Command Line

Python includes a built-in tool for pretty-printing JSON. You can use it like this:

cat file.json | python -m json.tool

Or create a convenient alias for the command:

alias json="python -m json.tool"

Now you can simply do:

cat file.json | json