Reputation: 3232
How can I deserialize only the items array?
{
"code": 200,
"bookmarks": {
"count": 2,
"items": [
{
"status": "I",
"id": "1",
"percent": 9,
"timestamp": 1462826317475
},
{
"status": "I",
"id": "2",
"percent": 10,
"timestamp": 1462909994981
}
],
"links": []
}
}
I know for an array I can do something like this:
List<MyClass> myObjects = mapper.readValue(jsonInput, new TypeReference<List<MyClass>>(){});
Can I specify only deserializing items?
Upvotes: 0
Views: 93
Reputation: 116472
Use ObjectReader
s at(JsonPointer)
method to specify sub-tree to bind. Something like:
Item[] items = mapper.readerFor(Item[].class).at("/bookmarks/items").readValue();
Upvotes: 1