0

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.

2
  • You should have type member as well. Commented Dec 28, 2015 at 9:09
  • Added the type field. How will that help the deserialization? Commented Dec 28, 2015 at 9:11

1 Answer 1

1

I think you can achieve that with Jackson Filter

Sign up to request clarification or add additional context in comments.

1 Comment

I think Jackson Filter is for serializing an Object to Json.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.