I\'ve been trying to create a Jersey REST Webservice. I want to receive and emit JSON objects from Java classes like the following:
@XmlRootElement
public cl         
        
I know it's been asked long time ago, but things changed mean time, so for the latest Jersey v2.22 that do not have anymore the package com.sun.jersey, these two dependencies added in the project pom.xml solved the same problem:
  org.glassfish.jersey.media 
  jersey-media-json-jackson 
  2.22 
 
  com.fasterxml.jackson.jaxrs 
  jackson-jaxrs-json-provider 
  2.5.4  
 
No need to add anything in web.xml. First dependency will instruct jersey to use jackson for POJO to JSON transformations. Second dependency will register jackson as jersey JSON provider.
Also for the null problem in POJO, add this annotation to the POJO class:
@JsonInclude(JsonInclude.Include.NON_NULL)