Posts tagged with: python

Pretty Print JSON from terminal

Have Python installed.

cat file.json | python -m json.tool > pretty_file.json

Python comes built in with a JSON encoding/decoding library, and you can use it to your advantage to get nice formatted output. Alternatively, if you are receiving JSON from an API or HTTP request, you can pipe your results from a curl call directly into this tool as well.