Formatting JSON with the Python JSON Tool

When working with web server JSON responses, if they span several lines with no ‘new line’ formatting they can be difficult to read. When JSON responses end up on the command line, it is possible to format them for easier reading.

Here I use a short output from the site as an example.

Copyable commands:

curl -s | python -m json.tool

For this, you will need python and mjson installed. Assuming you have python, you can check and install mjson as follows:

~$which mjson

~$pip install mjson

~$which mjson

Hope this is of use!

(Visited 111 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.