com! FormatJSON %!jq . nmap =j :FormatJSON<CR>
You need to have
jq installed. There are other tips out there that use Python but have various caveats. I've always got
jq available when I've got my .vimrc so this is preferable – and faster performance, in a few real world tests – for me.