JSON Microformat Converter

One of the goals in writing Michromeformats (a Chrome extension for displaying hCards, hCalendars, and hReviews) was to allow a user to download a specific hCard or hCalendar event and add it to Address Book or iCal.

The extension uses Sumo to parse the page, which picks out the various hcards and hcalendars, and stores them as objects which then get passed around within the extension.

Now, there’s plenty of conversion services out there already, but most of them seem to assume you want them to do the parsing by passing in the url of the page. Sumo has already done half the dirty work, so using one of these services didn’t feel right.

Using Sinatra, the vpim and ri_cal gems, and hosting it on Heroku, I had a working web service in no time that parsed a single microformat into a downloadable file.

The web service is pretty straightforward; it takes URI encoded JSON and turns it into either a .vcf or .ics file. So this:

  "n": {"givenName":"Brian","familyName":"Ryckbost"},
  "fn": "Brian Ryckbost",
  "url": ["http://www.ryckbost.com/"],
  "email": ["[email protected]"],

gets turned into this in michromeformats:


which if you follow the link ends up looking like this:

FN:Brian Ryckbost
ADR:;;170 W. 35th Street;Holland;Michigan;49423;USA
EMAIL:[email protected]

It’s not the prettiest URI I’ve ever seen, but it seems to gets the job done when it comes to downloading a specific vcard.

The code is on Github if you want to peak at the internals. Who uses microformats anymore anyways?



  1. January 09, 2011 at 2:45 AM

    Love your site design!!!