One of the features json.org mentions when describing JSON is that “It is easy for humans to read and write”. This is mostly true, however when you’re dealing with a large chunk of dynamically generated JSON it can be a little bit of a tougher ask for this human, especially if it’s in the context of an AJAX application where typically the JSON data will be lacking in formatting, indentation and white space in order to speed up transmission.
So here’s a couple of simple things we’ve found that help to make working with JSON slightly easier.
SublimeText – I really love working with SublimeText. Now, out of the box it comes with support for a lot of languages.. but not JSON. Never fear, as it supports Textmate .tmlanguage files, so you can add JSON support quite easily by downloading this .tmlanguage file and adding it to your Sublime Text\Packages directory. Restart SublimeText, and JSON highlighting can be yours.
However if your JSON is lacking in white space and carriage returns then even with the highlighting it’s not going to be too easy to read. Enter the next tool:
Combine these two simple tools together, and you’ve got a much improved JSON debugging experience!