March 2013

Half Marathon Denied

I was supposed to run the Berry Half Marathon today. This would have been my first half marathon, and I've been training for the past two months to run it.

Unfortunately, the event was cancelled due to lightning and poor course conditions after several hours of thunderstorms. So all I got out of it was a very expensive t-shirt.

A Web Page for Reformatting JSON Text

After I published my OS X Automator Service for Reformatting JSON Text, one commenter said that he always uses http://jsonformat.com/. I have used that, but I hate the output it produces. Its output is more readable than JSON with all the whitespace stripped out, but not by much.

It also seemed a little silly for such a web page to require a back-end service to do the work. I figured I could whip up a simple web page that wouldn't require any server round-trips to do its work, and that produced reformatted output that wouldn't make me cry.

Here it is: JSON Reformatter

You can look at the source here: https://gist.github.com/kristopherjohnson/5073681

Enjoy!


Update 2014-05-29: New version, implemented using AngularJS: http://undefinedvalue.com/2014/05/28/web-page-reformatting-json-text-using-angularjs

An OS X Automator Service for Reformatting JSON Text

Note: This is an old post. I now use jq (http://stedolan.github.io/jq/) instead of the formatjson Node script described below, and I recommend that you do too.

I had some JSON files that were not indented consistently. I edit these files by hand, so I wanted a way to easily reformat them.

My text editor has a reformatting command, but I really hate what it produces, so I decided to make my own JSON reformatting service for OS X that I could use in any application.