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 jsontest.com site as an example.
Copyable commands:
curl http://ip.jsontest.com/ curl -s http://ip.jsontest.com/ | 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 --snip-- ~$which mjson /usr/local/bin/mjson
Hope this is of use!
(Visited 134 times, 1 visits today)