I have this vim function/command that formats json
function! JSON() %!python -m json.tool setlocal ft=json endfunction command! Json call JSON()