Jackson overviewPosted: May 2, 2014
Recently I found the need to dig deeper and start getting a better grip on how jackson handles data parsing and manipulation. I always had some problems converting Jpa -> Date -> DateTime -> Json and back and forth, however, by plugin in some custom serializes/deserializers I always hacked my way around it.
Now that I’m starting to use Jongo I had to look at some features jackson provides to customize the mapping between mongo BasicDBObjects and POJOs
In the next few weeks I plan to write some blog posts show casing some cool features jackson offers.
One thing to make clear is that the official project is now being maintained under FasterXML, not Codehaus.
Codehaus is a collaborative environment for building opensource projects, jackson moved away from codehaus is now under the FasterXML umbrella
The last released made under the codehaus banner was in July 14 2013, version 1.9.13,
Some differences between the old and new jackson are:
- Maven build instead of Ant
- Annotations carved out to a separate package (that this package depends on)
- Java package is now com.fasterxml.jackson.core (instead of org.codehaus.jackson)
jackson-core – defines low-level streaming api, and includes JSON-specific implementations
The core package is where all the low level parser implementation is kept, some core classes that handle the raw json object creation are JsonReadContext and JsonWriteContext
More info can be found at their javadocs
jackson-annoations – contains standard jackson annotations
The annoations packages contains the definition of all the annoations used by jackson, 31 in total.
Some annoations worth noting are:
jackson-databind – implements data-binding and object serialization support on streaming packages
This is the package the handles most of the jackson parsing logic, classes like the ObjectMapper and SimpleModule are present in this packaged
The databind package bootstraps the annotations defined in the jackson-annotations package, one reason to separate the annoations from the databind package is to allow third party libraries to extend the utilize the annoations without having to include the whole databind package in its build.
Besides the main modules jackson also provides support for third party libraries, some of them are:
Overall jackson is a stable library that provides solid data manipulation support for different data types in java. The way it is architecture it allows new types to be easily implemented and it also provides a rich feature api that developers can extend to fit different application needs.
One thing I would say is that the documentation about jackson is very fragmented, I usually like to go to a single page and get all the info I need about a project, with jackson I always find myself hoping around between sites to find the info I need. It might be fragmented due to the change from codehaus to fasterxml, but in any case I would really like to see some effort into making the library more presentable.
I know for sure that several applications use jackson and the library is rock solid, its web presence should reflect the same image.
I’ll give one example: Jongo
Jongo documentation is pretty well done, plus other useful links regarding the project are well organized. Jongo uses jackson as its based parser, maybe jackson could use jongo presentation as an inspiration?