Pretty-printing JSON in the Terminal

I use cURL quite a bit when debugging APIs and I found this neat trick for pretty-printing JSON output. Add the following line to your .bashrc or .zshrc file,

alias json="python -m json.tool"

Then you can pipe your cURL output through your new json tool and print everything nicely,

curl -g http://some.domain/api/call | json