Latest version:, for JRuby 1.2+ and Java 6


JSON-JRuby is a Java port of Florian Frank's json library. It provides fast JSON generation and parsing for JRuby.


Just install the gem under JRuby:

$ jruby -S gem install json-jruby


Basic usage is quite straightforward:

#! /usr/bin/env jruby
require "rubygems"
require "json"

# de-serializing:
source_string = '{"sample": "Hello, world!"}'
puts JSON(source_string).inspect
# => {"sample"=>"Hello, world!"}

# serializing:
source_object = ["Just another Ruby Array", {"null value" => nil}]
puts JSON(source_object)
# => ["Just another Ruby Array",{"null value":null}]

For detailed usage and configuration parameters, see the json gem documentation.

Building from source

Check the project page for information regarding file downloads. To pull the Git repository:

$ git clone git://

The JDK version 1.6, JRuby 1.1.6 and Ragel 6.4 are needed to build this package.

After downloading a source package, you may need to configure the jruby.dir setting in nbproject/ (defaults to ../jruby). Ragel just needs to be in your path. Then, from the source's directory, you may run ant to build a gemfile.

Differences from json

For regular use, though, there are no practical differences between the libraries.

Author and license

This library has been written and is maintained by Daniel Luz, a.k.a. mernen, based on Florian Frank's work. Problems may be reported via GitHub issues.

JSON-JRuby, like json, is distributed under the Ruby license.