command! PrettyJSON %!python -m json.tool

or, coc.nvim + coc-prettier, which can format JavaScript/TypeScript/HTML/JSON using Prettier.