Closed toellrich closed 1 year ago
Yes, Jackson defaults to wrapping List
s by default.
This is different from JAXB defaults, but Jackson is not a JAXB implementation; it has partial support for JAXB annotations but does not have exactly same defaulting.
There is a way to change this default; I forget the method but there's one in XMLMapper
.
Thanks, found it. It is
XmlMapper mapper = XmlMapper.builder()
.defaultUseWrapper(false)
.build();
The issue can be closed.
Thank you for confirming @toellrich !
When serializing a list without
@XmlElementWrapper
, the list is still wrapped inside another element. The following unit test reproduces the problem:The second test when using Jackson instead of JAXB fails because the actual output is as follows:
but I would expect it to be like this:
I'm using java 17 and jackson 2.15.0-rc1.
test.zip