Post nested Json to spring controller using Jackson data binding
<p>Well I am trying to retrieve a nested json in spring controller and getting "The request sent by the client was syntactically incorrect."</p>

<p>My code is working and getting the correct data binding if I don't do nested json format, so I can conclude that maybe something is not right in my DTO.</p>

<p>CURL Command:</p>

<pre><code>CURL -i -H "Content-Type: application/json" -X POST http://localhost:8080/insertMapping -d '{"mapping": {"adobe_segment_id": "125", "dp_key_id": "1"}, "type": "adobe"}'
</code></pre>

<p>JSON:</p>

<pre><code>{"mapping": {"adobe_segment_id": "125", "dp_key_id": "1"}, "type": "adobe"}
</code></pre>

<p>Controller:</p>

<pre><code>@RequestMapping(value = "/insertMapping", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity&lt;String&gt; createUser(@RequestBody RequestBodyDTO mapping) {
    LOG.info("/insertMapping" + "   ,type:" + mapping.getType().getType());
    return null;
}
</code></pre>

<p>RequestBodyDTO:</p>

<pre><code>public class RequestBodyDTO {
private MappingDTO mapping;
private TypeDTO type;

public TypeDTO getType() {
    return type;
}

public void setType(TypeDTO type) {
    this.type = type;
}

public MappingDTO getMapping() {
    return mapping;
}

public void setMapping(MappingDTO mapping) {
    this.mapping = mapping;
}
}
</code></pre>

<p>MappingDTO:</p>

<pre><code>public class MappingDTO {
// adobe
private Integer adobe_segment_id;
private Integer dp_key_id;


public Integer getAdobe_segment_id() {
    return adobe_segment_id;
}

public void setAdobe_segment_id(Integer adobe_segment_id) {
    this.adobe_segment_id = adobe_segment_id;
}

public Integer getDp_key_id() {
    return dp_key_id;
}

public void setDp_key_id(Integer dp_key_id) {
    this.dp_key_id = dp_key_id;
}

}
</code></pre>

<p>TypeDTO:</p>

<pre><code>public class TypeDTO {
private String type;

public String getType() {
    return type;
}

public void setType(String type) {
    this.type = type;
}
</code></pre>

<p>}</p>