Photo-1 Photo-2 Photo-3 Photo-4 Photo-5 Photo-6



Full-time web developer. Part-time smart ass.

I'm Brent Collier.

After a year and a half as an engineer on Twitter's Trust & Safety team, I'm looking for my next gig. Contact me if you know of something interesting.


Formatting JSON in Vim

Posted on 01/21/2014

Typically when I'm dealing with JSON data, it's in the browser and I can use the handy JsonView Chrome extension, but in this particular instance it was a text file containing a string of json.

A quick google search led me to this blog post.

To format a file as json, run this command in Vim:

:%!python -m json.tool

Or, add this to your .vimrc, then select the bit of json and hit <mapleader>j.

map <Leader>j !python -m json.tool<CR>