According to jersey spec, we can use jersey-media-json-jackson to serialize/deserialize json/pojo, however from some thread in StackOverflow, we can use also jackson-jaxrs-json-provider 2.2.3
Can you please advise which one we should use?
Thanks,
The right way to do it is to use something like this in your maven configuration (if you are using maven, of course):
...
<properties>
<jersey.version>2.5.1</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
...
TL;DR - you should use jersey-media-json-jackson 2.5.1
Using the jackson library directly might break some of the auto-discoverable features of jersey.