title: How to send Integer value in the form of JSON format and recieve in REST Controller?
body: <p>I have one REST Controller where I have written this code</p>
  
  <pre><code>@PostMapping(value = "/otp")
  public void otp(@RequestBody Integer mobile) {
  
      System.out.println(" Mobile = "+mobile);
  }
  </code></pre>
  
  <p>And I am calling this method from Postman with the following inputs</p>
  
  <p><code>URL : localhost:8080/otp</code></p>
  
  <p><code>Body</code> :</p>
  
  <pre><code>{
      "mobile":123456
  }
  </code></pre>
  
  <p>But I am getting the following exception</p>
  
  <pre><code>org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Can not deserialize instance of java.lang.Integer out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.Integer out of START_OBJECT token
  </code></pre>
  
  <p>If I am taking String as a parameter like this</p>
  
  <pre><code>@PostMapping(value = "/otp")
  public void otp(@RequestBody String mobile) {
  
      System.out.println(" Mobile = "+mobile);
  }
  </code></pre>
  
  <p>And passing the inputs as</p>
  
  <pre><code>{
      "mobile":123456
  }
  </code></pre>
  
  <p>Now it is printing in the console as follows</p>
  
  <pre><code> Mobile = {
      "mobile":"123456"
  }
  </code></pre>
  
  <p>But I want only this value <code>123456</code>. How to achieve my requirement?</p>
  
  <blockquote>
    <p>NOTE: I don't want to create any additional POJO class or even I don't want to send the data using query/path parameter.</p>
  </blockquote>