Pretty Print JSON in command line
Two simple ways to get your cURL commands to output JSON in a human friendly manner.
# Node.js prettyjson
First install prettyjson from npm:
npm install -g prettyjson
Now you should be able to pipe cURL output to it, like so:
curl <url> | prettyjson
# Python mjson
You may need to install mjson first:
pip install mjson
Now you should be able to pipe cURL output to it, like so:
curl <url> | python -mjson.tool
# Further resources
If you're interested in a more in-depth look on this subject, checkout Ben Woodward's post. Theres also a pretty active stack overflow thread about this.
fetching pluses ...
Subscribe to the newsletter
No spam. Unsubscribe any time.