json-lib 2.2 has been released by Andres Almiray, and he boldly claims that "it now has become the most complete JSON parsing library". It supports Java, Groovy, and JRuby quite well, and Andres has an extensive set of json-lib examples to get you started.
But this post is about a project idea for anyone interested in tackling it: make a JRuby-compatible version of the fast JSON library from Florian Frank using Andres's json-lib (or another library of your choosing, if it's as "complete" as json-lib).
JSON is being used more and more for remoting, not just for AJAX but for RESTful APIs as well. Rails 2.0 supports REST APIs using either XML or JSON (or YAML, I believe), and many shops are settling on JSON.
So there's a possibility this could be a bottleneck for JRuby unless we have a fast native JSON library. There's json-pure, also from Florian Frank, which is a pure Ruby version of the library...but that will never compete with a fast version in C or Java.
Anyone up to the challenge? JRUBY-1767: JRuby needs a fast JSON library
Update: Marcin tells me that Florian's JSON library uses Ragel, which may be an easier path to getting it up and running on JRuby. Hpricot and Mongrel also use Ragel, and both already have JRuby versions.
Forgive my ignorance, but I don't think I understood it well.
ReplyDeleteAre you asking for a library that has an interface similar to Florian's library, but using json-lib as a backend? If so, why does Ragel matter at all?
And if you wish a full port of Florian's json, of what use would be json-lib?
Maybe there's some other possibility I'm missing here, so I'd be glad to have a clarification.