title: JSON body in Spring Boot's @RequestBody
body: <p>I have a spring boot application that accepts a JSON string in the body of the Http request. I made the controller like this</p>
  
  <pre class="lang-java prettyprint-override"><code>   @RequestMapping(method = RequestMapping.POST, consumes = MediaType.APPLICATION_JSON_VALUE, value = "/foo")
     public void acceptPost(@RequestBody TestModel t) {
          ....
     }
  </code></pre>
  
  <p>My JSON string is like this</p>
  
  <pre><code>    {
          "name" : "ABC",
          "age" : 20
      }
  </code></pre>
  
  <p>Spring Boot is able to marshal the request body into the <code>TestModel</code> POJO. But I am interested in doing the following</p>
  
  <pre class="lang-java prettyprint-override"><code>    @RequestMapping(method = RequestMapping.POST, consumes = MediaType.APPLICATION_JSON_VALUE, value = "/foo")
      public void acceptPost(String name, Integer age) {
          ....
      }
  </code></pre>
  
  <p>The <code>name</code> and <code>age</code> comes in as arguments without there being an intermediate object to hold the JSON string as it was passed.</p>
  
  <p>Is there any annotation that can be used or a way to override the existing interfaces or annotations in Spring Boot to help me get what I want?</p>