How can I pretty-print JSON in a shell script?
With Python 2.6+ you can do: echo ‘{“foo”: “lorem”, “bar”: “ipsum”}’ | python -m json.tool or, if the JSON is in a file, you can do: python -m json.tool my_json.json if the JSON is from an internet source such as an API, you can use curl http://my_url/ | python -m json.tool For convenience in all … Read more