Formatting JSON with VIM

I am working on an analytics project where we generate very complicated medical analysis and put it in a hierarchical data model.

{ "test" : { "test1" : "val1" } }

Open the JSON in vim and use python -m json.tool

:%!python -m json.tool


    "test": {
        "test1": "val1"

References (jq is another option, but… not always available on every system, python tends to work everywhere).