Usage :%!python -m json.tool Requires python to be installed. This command can also be stored in a macro in .vimrc: function! FormatJSON() :%!python -m json.tool endfunction