Java JSON-RPC -- A minimalist fork of, extending it for RPC, and '#' comments.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a fork of the reference implementation by Douglas Crockford, provided at, (which is based on ECMA-404, "The JSON Data Interchange Standard" and also documented as RFC 4627). When Mr. Crockford was asked by us to include RPC, he succinctly replied, "I don't believe in RPC." However, he welcomed any forks. This is this result.

There are three additions to the base code:

  1. Added three classes to support JSON-RPC v2.0: RPCError, RPCRequest, and RPCResponse
  2. Added support for comments in JSON syntax, when a line begins (No leading white space!) with a hash mark ('#')
  3. Added utility methods, JSONObject.keySet() and JSONObject.putAll()


This library should be backward compatible with any projects that used the reference implementation.

Comment Syntax

My implementation of comments is limited to "a '#' at column zero" in order to minimally change the reference implementation's parsing code. Note that comments are ignored (not preserved) while parsing JSON, so if you later call JSONObject.toString(), there will be no comments. Note that comments are not part of the official JSON specification, so you'll just have to ignore any corresponding syntax errors flagged by your JSON file editor.


The ANT build script offers two build sub-targets. The "build-core" target creates "json.jar" comprised of just the JSON and JSON-RPC classes. That's all you need for most JSON work.

The "build-plus" target creates "json+.jar" which includes the same core classes, plus extras that were included in the original library, specifically: JSON translations for XML, CDL (comma-delimited list), and HTTP headers.

Just run 'ant' inside the 'build' directory to build both. The core json.jar is 40% smaller than the json+.jar file. (Obviously you only need one in your classpath.)


The original work (most Java source files) are Copyright 2002
Additional work is Copyright 2010-2016 Augur Systems, Inc.
See individual files for specifics.