Siren: a JSONQuery interpreter for Ruby
Siren 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.
Also.. 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"!
July 19, 2009 at 4:55 pm
Siren looks pretty nice (funny I just wrapped up some work on JSONPath just recently, as well, http://github.com/bruce/jsonpath). Great work, James!
July 21, 2009 at 8:36 pm
I like JSONQuery of Dojo..