Format JSON in Vim

Just a quick tip if you're wanting to format JSON. Obviously it requires Python to be installed.

$ cat test.json | python -m json.tool

Additionally, if you use vim, it's worth pointing out that it's easy to use here too:

:%!python -m json.tool

And that's it!

Published 23 July 2018 - -