Pretty print JSON using the command line tools

anuragrana

Anurag Rana

Posted on July 11, 2019

Pretty print JSON using the command line tools

Option 1. Using python
cat FileName.json | python -m json.tool

Option 2. Colors and multiple options.
cat FileName.json~ | jq ''

Option 3. Pretty print with syntax highlighting.
echo '{"foo": "bar"}' | python -m json.tool | pygmentize -g

💖 💪 🙅 🚩
anuragrana
Anurag Rana

Posted on July 11, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related