title: SpringMVC 400 Bad request JSON data
body: <p>I have some problem with sending request to spring mvc controller.
  I have got entity:</p>
  
  <pre><code>public class Person {
      private String name;
      private int age;
      private String city;
      //..getters setters
  
  }
  </code></pre>
  
  <p>and SpringMvc controller:</p>
  
  <pre><code>@Controller
  @RequestMapping("/companies")
  public class FirmaController {
      @RequestMapping(value = "/addPerson", method = RequestMethod.POST, headers = {"Content-type=application/json"})
      public String addPerson(@RequestBody Person person) {
          return "person";
      }
  }
  </code></pre>
  
  <p>When i would like to send request to server with curl:</p>
  
  <pre><code>curl -i -X POST -HContent-Type:application/json  -HAccept:application/json http://localhost:8080/api/companies/addPerson -d "{ 'name': 'Gerry', 'age': 20, 'city': 'Sydney' }"
  </code></pre>
  
  <p>i have got a <strong>HTTP/1.1 400 Bad Request</strong>:</p>
  
  <pre><code>HTTP/1.1 400 Bad Request
  Content-Type: text/html;charset=ISO-8859-1
  Cache-Control: must-revalidate,no-cache,no-store
  Content-Length: 1392
  Server: Jetty(8.1.10.v20130312) 
  </code></pre>
  
  <p>What I do wrong?</p>