title: Jackson not consuming the JSON root element
body: <p>I'm using JAX-RS + Jersey to consume the web-service request and Jackson to translate JSON data:</p>
  
  <pre><code>@Path("/")
  public class JAXRSRestController {
      @Path("/jsonRequest")
      @POST
      @Consumes(MediaType.APPLICATION_JSON)
      public Response submitJsonRequest(SampleObject sampleObject, @Context HttpHeaders headers)
      {
          Ack ack = new Ack();
          ack.setUniqueId(sampleObject.getId());
          ack.setType(sampleObject.getName());
          return Response.ok().entity(ack).build();
      }
  }
  </code></pre>
  
  <p>Here if the request is in the below format, it would not be consumed:</p>
  
  <pre><code>{
    "sampleObject": {
      "id": "12345",
      "name": "somename"
    }
  }
  </code></pre>
  
  <p>But if the request is in the below format, it will be consumed:</p>
  
  <pre><code>{
      "id": "12345",
      "name": "somename"
  }
  </code></pre>
  
  <p><strong>How can I make the controller consume the Json root element as well?</strong></p>
  
  <p>SampleObject class:</p>
  
  <pre><code>import org.codehaus.jackson.map.annotate.JsonRootName;
  
  @XmlRootElement(name = "sampleObject")
  @JsonRootName(value = "sampleObject")
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name  = "SampleObject", propOrder = {
          "id",
          "name"
  })
  public class SampleObject 
  {
      protected String id;
      protected String name;
  
      public SampleObject(){}
  
      public SampleObject(String id, String name) {
          this.id = id;
          this.name = name;
      }
      public String getId() {
          return id;
      }
      public void setId(String id) {
          this.id = id;
      }
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p>web.xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding= "UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" &gt;
    &lt;display-name&gt;Wed Application&lt;/display-name&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;Jersey RESTFul WebSerivce&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;com.sun.jersey.config.property.packages&lt;/param-name&gt;
          &lt;param-value&gt;com.jaxrs.rest&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;com.sun.jersey.api.json.POJOMappingFeature&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Jersey RESTFul WebSerivce&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>