title: Reading Content-Type application/json in Spring
body: <p>Like in <a href="https://stackoverflow.com/questions/29313687/trying-to-use-spring-boot-rest-to-read-json-string-from-post">trying-to-use-spring-boot-rest-to-read-json-string-from-post</a> I want to read a json payload from a POST request in a Spring RestController. Using the content type "text/plain" there is no problem, but with "application/json" the deserialization fails and I get a MessageNotReadable exception. But actually the content couldn't be simpler, it is just an empty json object "{}". Could it be that a required converter is missing?
  I use Spring Root version 1.2.3.RELEASE.</p>
  
  <p><strong>Coding Example</strong></p>
  
  <pre><code>@RequestMapping(value = "/deepdefinitions", method = POST, headers = "Accept=application/json")
  @ResponseBody
  public Definitions createOrUpdateDefinitions(HttpEntity&lt;String&gt; httpEntity) throws IOException { ... }
  </code></pre>
  
  <p><strong>Curl Call</strong></p>
  
  <pre><code>curl -H  "Content-type: application/json" -X POST -d '{}' http://localhost:8080/deepdefinitions
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>{"timestamp":1434397457853,"status":400,"error":"Bad Request","exception":"org.springframework.http.converter.HttpMessageNotReadableException","message":"Could not read JSON: Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@122f9ce3; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@122f9ce3; line: 1, column: 1]","path":"/deepdefinitions"}
  </code></pre>