Working with restful api that returns a json string. The format is
{
"status": "ok",
"result": { <the method result> }
}
I am trying to map the response for user profile to UserProfile.class
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>();
parameters.set("method", "currentUser");
URI url = buildUri("users/show.json");
UserProfile profile = this.getRestTemplate().postForObject(url, parameters, UserProfile.class );
User profile has all the fields from response result. if I add fields String status, UserProfile result, it maps the UserProfile to result and I can extract it from there, but that feels a little wrong.
I want postForObject function to map the JSON response relevant leaf "result" to UserProfile.class