i need help parsing a response with the jackson mapper to a POJO. i have this as a response:
"data": [{
"item": {
"downloaded": false,
"moderated": false,
"add": false
}
},
{
"item": {
"downloaded": false,
"moderated": false,
"add": false }
// more
so how do i bind this one with the mapper to a POJO? here is my class that i am trying but it returns that "item" is not recognized and not allowed to be ignored.
public ArrayList<Item> data = new ArrayList<Item>();
where item is a public static class Item with constructors and all the fields above with getters and setters.
how do i do this. i cant seem to find anywhere how to read data from an array this way.
JsonNode jsonNode = mapper.readValue(s, JsonNode.class);
JsonNode userCards = jsonNode.path("data");
List<Item> list = mapper.readValue(userCards.toString(), new TypeReference<List<Item>>(){});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With