views:

191

answers:

1

I need a library to handle JSON objects in Ruby. There are two gems available json and json_pure on http://rubygems.org/search?query=json

json_pure is written only in Ruby while json is using C. All I understand is that json is faster because of the usage of C. So is json better for production?

Both seem to be easily installed just by running gem install command. When I install Nokogiri, I need to do something extra. I thought the extra work is required because Nokogiri is using C extensions, but I don't need to do anything extra for json gem.

  • What's advantages and disadvantages for json and json_pure?
  • Assuming installing json is easy, what's the benefit of json_pure?
+1  A: 

Nokogiri need extra librarie because it's on libXML. Json has no librarie dependencies. So you don't need other extra.

The advantage of json is like you said, that is in C, so performance are really better than json_pure.

The interest of json_pure can be if you don't have MRI. By exemple the json_pure gem can be install in JRuby/Maglev or other implementation. json can't be. He need a FFI plugin to do that.

shingara