I have a Jackson Question.
Is there a way to deserialize a property that may have two types, for some objects it appears like this
"someObj" : { "obj1" : 5, etc....}
then for others it appears as an empty array, i.e.
"someObj" : []
Any help is appreciated!
Thanks!
Jackson doesn’t currently have a built-in configuration to automatically handle this particular case, so custom deserialization processing is necessary.
Following is an example of what such custom deserialization might look like.
(You could make use of DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY to force the input to always bind to a collection, but that’s probably not the approach I’d take given how the problem is currently described.)