JSON formatting in vim
To format JSON in a file in vim you can use the following:
:%!jq .
%
symbol refers to the content of the current file
and to format selected text in vim you can use the following:
:'<,'>!jq .
the '<,'>
symbol refers to the selected text in visual mode
N.B. This requires jq
utility to be installed
Last Updated: 28/06/2023
Published: 28/06/2023