title: Return an object using ResponseEntity with JSONObject as one of the object's field
body: <p>My model looks like below, where in bookJson is a json object - </p>
  
  <pre><code>{
      "name" : "somebook",
      "author" : "someauthor"
  }
  
  public class Book{
      private int id;
      private JSONObject bookJson;
  
     public int getId(){return this.id;}
     public JSONObject getBookJson(){this.bookJson;}
     public void setId(int id){this.id = id;}
     public void setBookJson(JSONObject json){this.bookJson = json;}
  
  }
  </code></pre>
  
  <p>JSONObject belongs to org.json package</p>
  
  <p>When My RestController returns Book object in a ResponseEntity object , I get the error - </p>
  
  <pre><code> "errorDesc": "Type definition error: [simple type, class org.json.JSONObject]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) 
  </code></pre>
  
  <p>What is the best way to achieve this?</p>
  
  <p>Can we not achieve this without having to have a model class with all fields of bookJson?</p>