title: JSONObject as a member variable in POJO not recognized -Jersey
body: <p>I'm building a RESTful web service. I've been locked in a situation where I'm not able to proceed. I've a DAO (a POJO) that has a <code>JSONObject</code> as a member variable. When I try to make a POST call from client (Postman or user-defined javascript) and try to debug, the value gathered in the getter of the <code>JSONObject</code> is empty ({}) whereas the other members of the class obtain their appropriate values. I've tried annotating the <code>JSONObject</code> and its getter with <code>@XmlElement</code>, <code>@JsonProperty</code> and so on.. Nothing worked.</p>
  
  <p>The class looks like :</p>
  
  <pre><code>package org.somepackage
  
  import javax.xml.bind.annotation.XmlRootElement;
  
      import org.codehaus.jackson.annotate.JsonAutoDetect;
      import org.codehaus.jackson.annotate.JsonProperty;
      import org.json.JSONObject;
  
  
      @XmlRootElement
  
      public class someClass {
          private String someID;
          private String someName;
  
          private JSONObject someJsonObject;
  
  
          public someClass () {
  
          }
          public someClass (String id, String name,
                  JSONObject jsonObj) {
              someID=id;
              someName=name;
              someJsonObject=jsonObj;
  
          }
          public String getSomeID() {
              return someID;
          }
          public void setSomeID(String id) {
              this.SomeID= id;
          }
          public String getSomeName() {
              return someName;
          }
          public void setSomeName(String name) {
              this.someName= name;
          }
  
          public JSONObject getSomeJsonObject() {
              return someJsonObject;
          }
          public void setSomeJsonObject(JSONObject jsonObj) {
              this.someJsonObject= jsonObj;
          }
      }
  </code></pre>
  
  <p>I appreciate your help!
  Thanks.</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>Example JSON</p>
  
  <pre><code>{ 
    "name": "ABCD", 
    "ID": "P63784433", 
    "theJSON":{
      "string":"foo",
      "number":5,
      "array":[1,2,3],
      "object":{
        "property":"value‌​",
        "subobj":{
          "arr":["foo","ha"],
          "numero":1
        }
      }
    }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>DEPENDENCY</strong>
  web.xml dependency on Jackson</p>
  
  <pre><code>                        &lt;dependency&gt;
                                  &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
                                  &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
                                  &lt;version&gt;1.9.2&lt;/version&gt;
                          &lt;/dependency&gt;
  
                          &lt;dependency&gt;
                                  &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
                                  &lt;artifactId&gt;jackson-core-asl&lt;/artifactId&gt;
                                  &lt;version&gt;1.9.2&lt;/version&gt;
                          &lt;/dependency&gt;
  
                           &lt;dependency&gt;
                                  &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
                                  &lt;artifactId&gt;jackson-jaxrs&lt;/artifactId&gt;
                                  &lt;version&gt;1.9.2&lt;/version&gt;
                           &lt;/dependency&gt;
  
                           &lt;dependency&gt;
                                  &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
                                  &lt;artifactId&gt;jackson-xc&lt;/artifactId&gt;
                                  &lt;version&gt;1.9.2&lt;/version&gt;
                          &lt;/dependency&gt;
  
                          &lt;dependency&gt;
                                  &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
                                  &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
                                  &lt;version&gt;2.6.2&lt;/version&gt;
                          &lt;/dependency&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>RESOURCES AND PROVIDER REGISTER through web.xml</strong> </p>
  
  <pre><code>    &lt;!-- Register JAX-RS Application --&gt;
     &lt;init-param&gt;
          &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt;
          &lt;param-value&gt;my.package.MyApplication&lt;/param-value&gt;
      &lt;/init-param&gt;
  
      &lt;!-- Register resources and providers under my.package. --&gt;
     &lt;init-param&gt;
          &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
          &lt;param-value&gt;my.package&lt;/param-value&gt;
      &lt;/init-param&gt;
  
      &lt;!-- Register custom provider  --&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;jersey.config.server.provider.classnames&lt;/param-name&gt;
          &lt;param-value&gt;my.package.mapper.ObjectMapperProvider&lt;/param-value&gt;
      &lt;/init-param&gt;`
  </code></pre>
  
  <hr>
  
  <p><strong>MyApplication.java</strong></p>
  
  <pre><code>`@ApplicationPath("/")
  public class MyApplication extends ResourceConfig {
  
  public MyApplication() {
      // Register resources and providers using package-scanning.
      packages("my.package");
  
      register(ObjectMapperProvider.class);
  
  
  }`
  </code></pre>