Reputation: 130
Suppose I have this JSON Array
[{"type":"type1", "id":"1", "name":"John"},
{"type":"type1", "id":"2", "name":"Jane",
{"type":"type2", "id":"3", "name":"Joseph"}]
And I have these Java objects
public class Person {
Long id;
String name;
String type;
}
public class MainClass {
List<Person> persons;
}
Is there a way to deserialize the JSON array such that only those that are type type1 will be included? Those with type2 should not be set as null but completely ignored.
Upvotes: 0
Views: 551