Spring boot jackson - deserializes Json with root name
<p>I have the below Json</p>

<pre><code>{
    "user": {
        "name": "Ram",
        "age": 27
    }
}
</code></pre>

<p>which I want to de-serialize into an instance of the class</p>

<pre><code>public class User {
    private String name;
    private int age;

    // getters &amp; setters
}
</code></pre>

<p>For this, I have used <code>@JsonRootName</code> on class name and something like below</p>

<pre><code>@Configuration
public class JacksonConfig {

    @Bean
    public Jackson2ObjectMapperBuilder jacksonBuilder() {
        Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
        builder.featuresToEnable(DeserializationFeature.UNWRAP_ROOT_VALUE);
        return builder;
    }
}
</code></pre>

<p>But it did not work as expected. If I send something like below, it worked.</p>

<pre><code>{
 "name": "Ram",
 "age": 27
}
</code></pre>

<p>But I want to get the json de-serialized with root name. Can any one please suggest?</p>

<p>I want to spring boot way of doing this.</p>