Jackson JSON Processor

News!

  • 24-Mar-2008: Version 0.9.2 released. Besides some bug-fixes, also includes turbo-charged new parser (for UTF-8 encoded docs).
  • 26-Mar-2008: Jackson was approved as a new project at Codehaus , and so the home page will eventually move to jackson.codehaus.org.
  • 14-Mar-2008: Version 0.9.1 released. Apart from minor fixes, JsonGenerator now has pretty printing capability (JsonGenerator.useDefaultPrettyPrinter()).
  • 16-Feb-2008: Moved downloads to a Download Page.
  • 14-Feb-2008: Version 0.9.0 released. Some more fixes to Java/Json type mappers.
  • 03-Feb-2008: Version 0.8.2 released. Contains fixes to Java type mapper.
  • 05-Dec-2007: Version 0.8.1 released. Contains mostly fixes, esp. to the Java type mapper. Some minor performance improvements added as well.
  • 17-Oct-2007: Version 0.8 released. Adds preliminary "JSON type mapper" (org.codehaus.jackson.map.JsonTypeMapper), which allows binding of JSON data to JsonNode instances. This is quite similar to DOM (XOM / JDOM / DOM4j) trees with xml. Specific benefit is convenient path-access using "getPath()" methods that can traverse through JSON arrays and objects.
  • 17-Sep-2007: Version 0.7 released. Adds the "Native mapper" (org.codehaus.jackson.map.JavaTypeMapper), which allows binding of JSON data to and from basic Java types like List, Maps, Strings, Numbers and Booleans. Code samples will be forthcoming.

A useful resource regarding Jackson development (and related things) is the Cowtown Blog.

What?

Jackson is a:
  • Streaming
  • Light-weight
  • FAST
  • Fully conformant
  • Open Source
JSON processor (JSON parser + JSON generator).

So what do these properties mean?

  • Streaming means similar things here as it does with, say, STreaming Api for Xml processing for xml: low memory and processing overhead, and ability to process content of arbitrary length. Specifically, with JSON you can have tera-byte long streaming communication, and deal with it piece by piece.
  • Light-weight: streamability allows for light-weight operation, and Jackson makes very economic use of resources at its disposal. It also has minimal dependencies: all you need is Java 5 (JDK 1.5) and you are good to go!
  • FAST: given above points, it should come as no surprise that Jackson is blazingly fast. It is significantly faster (TODO: measure exact ratio!) than the Json Parser Reference Implementation.
  • Fully conformant: Jackson implements the official JSON format specification to the tee. And it will NOT try to add any proprietary extensions at syntax level, to maximize interoperability.
  • Open Source: Jackson is dual-licensed and available under both LGPL (Free software) and ASL Open Source licenses.

Current functionality

So what exactly does Jackson do for you? It lets you:
  • Read (parse) valid JSON content, value by value. Parsers are constructed by JsonFactory instances, from usual sources (InputStreams, Readers, URLs, Files).
  • Write (generate) valid JSON content, likewise value by value. Generator are constructed by JsonFactory instances, with usual targets (OutputStreams, Writers, Files).
  • Bind JSON values to/from core Java wrapper (Number, String) and the collection (List, Map) classes (using org.codehaus.jackson.map.JavaTypeMapper). Either get a JsonParser and ask mapper to parse JSON into a Map, List, String, Boolean or Number (depending on which JSON token content has as its root); or pass one of such Java types (or an array, or other general types you would expect to be mappable) to mapper, along with a JsonGenerator, and get valid Json content out.
New features will be forthcoming before 1.0 release, see below for details.

Download

For now, Jackson source repository is not set up for external access. But you can download sources and binaries from the download page.

Mailing Lists

Mailing lists (dev, user) are hosted by Codehaus and open for subscription.

Future

In near future, Jackson will migrate to Codehaus. Its new home should thus be named http://jackson.codehaus.org.

Immediate development plans:

  • Implement "Java Native" binding, which allows JSON values to be bound to Java Lists, Maps, Numbers, Booleans and Strings. (completed with 0.7 release)
  • Implement "Dynamic JSON" binding, which allows JSON values to be accessed using value objects similar to DOM elements (but with less cumbersome, XPath-like access methods) (partially completed with 0.8 release)
  • Implement "HTTP URL Query parameter" binding, allowing mapping of query parameters to structured JSON, using simple dot-separated naming convention.
  • Add efficient "binary" access methods (automatic base64 encode/decode for String values to express binary data)
  • Full mapping between Java and Json types, readers and writers, to allow translations between equivalent representations.
Additionally, there are other related plans that may be included either as part of Jackson, or as separate add-ons:
  • JsonPath?
  • Efficient (but simple), interface-based Object-binding framework ("JSON data access objects")
  • Binary Json representation; similar to how BNux works for XML.

Author

Jackson package is being written by Tatu Saloranta: accessible via email address "cowtowncoder" at "yahoo" dot "com". Likes to hear praise, will try to gracefully accept criticism.

Author has tendency to scribble about various related and non-related things at Cowtown Blog (readers beware!).


Back to Cowtowncoder.com Hatchery page.