How to format JSON in VIM/GVIM

The strength and beauty of VIM is the simple interaction with lots of external programs.

To format any JSON file in VIM/GVIM:

:% !jq .

% means the file you’re working on, and `!jq` is run the external command `jq`

That’s all.

You need to have `jq` installed:
sudo apt install jq
whatis jq
jq (1) - Command-line JSON processor

Leave a Reply



Categories
Archives
Links