How to serialize Joda DateTime with Jackson JSON processor?

This has become very easy with Jackson 2.0 and the Joda module.

ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JodaModule());

Maven dependency:

<dependency>
  <groupId>com.fasterxml.jackson.datatype</groupId>
  <artifactId>jackson-datatype-joda</artifactId>
  <version>2.1.1</version>
</dependency>  

Code and documentation:
https://github.com/FasterXML/jackson-datatype-joda

Binaries:
http://repo1.maven.org/maven2/com/fasterxml/jackson/datatype/jackson-datatype-joda/

Leave a Comment