Open vtarchon opened 10 months ago
it looks like if the array is initialized to an empty array or if i add @JsonInclude(JsonInclude.Include.NON_EMPTY)
to the class, it'll serialized without the empty element when the wrapper is disabled.
I think there is unfortunately ambiguity wrt XML with default settings, for this case. But enabling ToXmlGenerator.Feature.WRITE_NULLS_AS_XSI_NIL
should help preserve null
as null
-- this settings is disabled by default for backwards-compatibility reasons (added in 2.10).
I noticed that when i serialize an object with a null list and disable using a default wrapper around lists, upon deserialization the object returned differs from the object serialized.
Here is a test of the problem
class
Parent
has a list of classChild
that is null, when this object is serialized the following xml isif you take this xml and deserialize it back into a
Parent
object what ends up happening is that the children property is a list that has one element, an object ofChild
with null properties. I was expecting that Parent would have a null list instead.If you enable wrapper, it works fine and the serialized xml is
which deserializes into the same object as the original