title: Spring RequestBody with either List<Object> or Object. Name for both are same "data"
body: <p>I want to handle json request for List of Object and Object it self in the same Spring controller. Below is the exact example.</p>
  
  <p>Json Request for Single Object:</p>
  
  <pre><code>{"data":{"prop":"123456","prop2":"123456"}}
  </code></pre>
  
  <p>Json Request for List of Objects:</p>
  
  <pre><code>{"data":[{"prop":"123456","prop2":"123456"},{"prop":"123456","prop2":"123456"}]}
  </code></pre>
  
  <p>My Controller is as follow.</p>
  
  <pre><code>@PostMapping(path="/path")
  public @ResponseBody String getSomething(@RequestBody Input data){
       return service.getSomething(data);
  }
  </code></pre>
  
  <p>I want to handle both of this requests in a single spring controller.</p>
  
  <p>Appreciate your help.
  Thanks.</p>