Usage

If you require JSON like this:

require 'json'

JSON first tries to load the extension variant. If this fails, the pure variant is loaded and used.

To determine, which variant is active you can use the follwing methods:

If you want to enforce loading of a special variant, use

require 'json/ext'

to load the extension variant. Or use

require 'json/pure'

to use the pure variant.

You can choose to load a set of common additions to ruby core's objects if you

  require 'json/add/core'

To get the best compatibility to rails' JSON implementation, you can

    require 'json/add/rails'

Both of the additions attempt to require 'json' (like above) first, if it has not been required yet.