How do I format and pretty-print JSON in the current Vim buffer using Python?
:%!python -m json.tool
When editing JSON files in Vim, you can pipe the entire buffer through Python's built-in json.
:%!python -m json.tool
When editing JSON files in Vim, you can pipe the entire buffer through Python's built-in json.
:%!python3 -m json.tool
The :%! command pipes the entire buffer through an external command and replaces it with the output.
command-line #command-line #shell #formatting #json #workflow