:%!python -m json.tool
It will get the contents of the currently open file, redirect them to the
command python -m json.tool
and replace the contents of the file with the result.
It can be used outside of Vim like so:
cat ugly.json | python -m json.tool > pretty.json