title: How to access internal json object in Spring Rest Request
body: <p>I want to create one API which format will be like below.</p>
  
  <pre><code>{
             "jsonObject": {
                       //some json object     
             },
             "key": "SampleKey",
             "jsonDataKey": "SampleDataKey"
  }
  </code></pre>
  
  <p>for this I have created the RequestBody class as below.</p>
  
  <pre><code>public class ParentJsonInfo {
  public String getKey() {
      return key;
  }
  
  public void setKey(String key) {
      this.key = key;
  }
  
  private String key;
  
  public JsonObject getJsonData() {
      return jsonData;
  }
  
  public void setJsonData(JsonObject jsonData) {
      this.jsonData = jsonData;
  }
  
  private JsonObject jsonData;
  
  public String getJsonDataKey() {
      return jsonDataKey;
  }
  
  public void setJsonDataKey(String jsonDataKey) {
      this.jsonDataKey = jsonDataKey;
  }
  
  private String jsonDataKey;
  </code></pre>
  
  <p>}</p>
  
  <p>but unfortunately I am not getting any data inside the json object of my class. M I doing anything wrong. please guide me to how should i access the data inside that object.</p>
  
  <p>Here is the controller method code.</p>
  
  <pre><code>@RequestMapping(value = "/postNews", method = RequestMethod.POST)
  public Greeting greeting(@RequestBody ParentJsonInfo parentJsonInfo) {
   Jsonobject jsonObject= parentJsonInfo.getjsonObject();
  }
  </code></pre>