The structure of the object must match the structure of JSON, so it is often convenient to use wrapper classes if necessary. Sort of:
class Response { public Thing value; } class Thing { public String name; }
so even if you just want a "name", you would do something like:
Response resp = mapper.readValue(jsonInput, Response.class); String name = response.value.name;
If so, you can omit defining properties that you do not need; or identify them and not use them.
source share