Today I Learned

A Hashrocket project

Ready to join Hashrocket? Find Openings here and apply today.

Pretty format a json file in vim with jq

Viewing a minified or unformatted json in vim can be a headache. But luckily for us, that’s an easy fix if you have jq installed. The following command will pass the contents of your current buffer to the jq external command for formatting:

:!% jq .

Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.