Validating JSON in Emacs

At work, I have to deal with Amazon CloudFormation 1 templates a fair bit. These templates are JSON files. More and more members of our team are moving away from TextMate to Emacs which makes me really happy. We would like to validate these CloudFormation templates in Emacs. Today we set this up and I hope this turns out to be of help to some one else trying to do the same.

Grab jsonlint. It is a command line utility that validates JSON. There seems to be two flavors of jsonlint available. A pure JavaScript implementation 2 that runs on the Node.js runtime and a native Mac OS X 3 version. We use the Node.js version.

Ensure that your Emacs can find the jsonlint binary. This can be done by adding the following snippet in your Emacs configuration: