The last minor version of Jackson that I reviewed at Cowtown Blog was 2.3, which was released in November 2013. Actually that was the last thing I wrote over there.
A lot has happened since, considering that I am now starting to finalize the feature set of Jackson 2.8 (yay!). But since it does not look like there is a lot of material on new features — at least on version-by-version basis — it seems useful to go back and do retroactive review (postview?) of what was included. So let’s start with Jackson 2.4.0, released in June 2014.
Release Notes for Detailed-oriented Readers
First things first: you can find more detailed version at Jackson 2.4 release notes page. But here’s a bit more selective sample of everything that was included.
General goals of 2.4
Compared to previous releases, 2.4 was more focused on incremental improvements and fixes to existing features. There weren’t many major new features introduced. Due to this focus, branch was also quite long-lived: there are patch releases up to 2.4.6 (April 2015), and there were altogether 66 bug fixes in these patch versions, according to release notes. Branch is closed since 2.4.6, although there is always a theoretical possibility of further micro-patches (220.127.116.11 and further).
New modules introduced
Two modules had their formal official release as part of 2.4 suite:
- CBOR module for reading/writing data encoded using “binary JSON” format called CBOR
- Jackson jr, a light-weight “mini-Jackson” library for simple JSON use cases
Of these CBOR module has become quite widely used, and potential alternative to Smile format module. I may write a bit about differences between CBOR and Smile in future; for now suffice it to say that the formats are quite similar, but Smile has some benefits for large data streams use case (think Hadoop or Spark)
Jackson jr is my attempt at producing a “casual” JSON processing library. It uses solid, mature Jackson streaming component (aka `jackson-core`), so parsing is done using `JsonParser`, writing `JsonGenerator`, but otherwise provides a very simple data-binding implementation for Beans, as well as fluent-like Composer interface for constructing JSON output. The main benefits are much more compact size (jackson-jr itself below 100kB; and when bundled with `jackson-core` around 300kB), and faster startup time. These benefits may be important for platforms like Android, or for use cases where JSON access is limited: for example when reading JSON configuration files, or sending simple JSON requests.
Significantly improved modules
Highlighted new/improved features
Of included changes, here’s a sampling of things that to me seemed like most important new or improved features:
- Allow use of `@JsonPropertyOrder` for Java Map valued properties (not just POJOs)
- `DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS`, which allows reading of a single JSON value into List/array valued property, similar to as if the value was wrapped in JSON Array, while also allowing expected JSON Array values. This is useful when supporting legacy notations where distinction between single-valued array and single value can not always be determined — common when converting from XML data, for example
- Supporting “forward-references” for Object Ids: that is, having an Object Id reference before actual Object Id declaration (id property of a fully serialized POJO) has been seen. While Jackson itself always writes Object Id declarations first, and only uses references after that, not all tools guarantee such ordering.
Retrospect for 2.4
After seeing the full 2.4 release along with patches, this version proved to be stable and widely used. Focus on incremental improvements paid off, and of existing dependencies (across all depending projects), version 2.4.4 is still amongst top 5 versions according to, say, Mvnrepository.com. There also seemed to fewer compatibility issues (wrt other Jackson minor versions) than some of the later updates. But that’s a story for another day.