Given a file with a large JSON object all on one line like
How can I format this to be human readable in Vim?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
This one-liner works well to format JSON in Vim into a human readable form:
:%!python -m json.tool
Or you can install
jq which is faster (written in C) from your package manager or from source and then in vim, type :