If you are writing a JSON api in Rails or using gems like Ripple to talk to a JSON-based datastore like Riak, there is a trick in ActiveSupport that allows you to improve JSON decoding by using a better decoding library.
By default ActiveSupport will decode JSON using the YAML gem which is not too bad, but there is better. In fact when in your Rails app you require the json gem like this:
ActiveSupport will try to load the 'yajl' (Yet Another JSON Library) first and, if it can't find it, it will load YAML instead and use it to do the parsing. This mens that if you add the 'yajl-ruby' gem to your project, your JSON parsing will be faster. All you have to do is add this line to your Gemfile:
and you are done. If you want to see for yourself how the loading is done you can just go to the 'activesupport' installation directory in your system and check the file 'json/decoding.rb'.
If you are unsure where to find the gem's path you can use:
bundle show activesupport