Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Siren: a JSONQuery interpreter for Ruby

By Ric Roberts / July 17, 2009

sirenSiren is a JSON and JSONQuery interpreter for Ruby by James Coglan. Before I dive into talking about Siren, a little bit of background:

JSON is a lightweight, human-friendly data interchange format, for which there is already good Ruby support in the form of the json gem. JSONQuery was originally added as part of the dojo javascript toolkit and provides querying tools for JSON such as filtering and sorting etc. (check out this article on SitePen for more details). You can also find a stand-alone port of JSONQuery on Github.

Anyway, Siren lets you run queries against any type of Ruby object. In addition to the standard JSONQuery features, Siren allows JSON objects to be assigned IDs, enabling cross referencing and cyclic data structures. It also allows you to tell the parser to cast objects to an instance of a particular type, populating instance variables with the data (rather than just using vanilla hashes or arrays like most JSON tools).

Siren is available on James's Github account. Check out the README for more details on the supported features.

jslab.pngAlso.. Jumpstart Lab in Washington, DC is offering workshops teaching Ruby for beginning female programmers (Ruby Jumpstart) on August 1st and 2nd, then beginning Rails (Rails Jumpstart) for everyone on August 15 & 16. Save 10% with code "rubyinside"!


  1. Bruce Williams says:

    Siren looks pretty nice (funny I just wrapped up some work on JSONPath just recently, as well, Great work, James!

  2. ReddyOnRails says:

    I like JSONQuery of Dojo..

Other Posts to Enjoy

Twitter Mentions