I am using Jackson for JSON parsing and I have the following JSON structure:
["foo", {"baz": []}, {"myList": ["a", "b", "c"]}]
I would like to ONLY serialize objects with property "myList" into
public class MyClass {
List<String> myList;
}
where ["a", "b", "c"] is used as the value of myList. All other objects should just get turned into the default Map<String, Object> and everything else (arrays, strings, etc) should turn into whatever the defaults are.
Is there a way to do this?
You can search the content tree for the "myList" element and append its values to "MyClass" if it's to be found; otherwise, simply redirect the content to the standard deserializer.
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