title: Sending nested json object in POST method using Postman to Spring REST API
body: <p>i am trying to send nested json object in POST request to my spring REST API.</p>
  
  <p>Object java code</p>
  
  <pre><code>public class TestModel {
  private String id;
  private String name;
  
  public TestModel(String id, String name) {
      this.id = id;
      this.name = name;
  }
  
  public String getId() {
      return id;
  }
  
  public String getName() {
      return name;
  }
  </code></pre>
  
  <p>}</p>
  
  <hr>
  
  <p>Post method code in rest controller</p>
  
  <pre><code>@RequestMapping(value = "/helloPost")
  public ResponseEntity&lt;TestModel&gt; helloPost(@RequestBody TestModel t) {
      return new ResponseEntity&lt;TestModel&gt;(t, HttpStatus.OK);
  }
  </code></pre>
  
  <hr>
  
  <p>My postman screenshot</p>
  
  <p><a href="https://i.stack.imgur.com/uqUyg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uqUyg.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>It has to return status 200 ok and object i sent, but it returns 400 bad request permanently.
  Please, tell me what am i doing wrong. It was ok when i sent one string(my @RequestBody was string too) but completly not working with custom objects.</p>
  
  <p>P.S
  i have added comma, no changes</p>