@Xml Collapsed Format
The XmlFormat.COLLAPSED format can be applied
to bean properties of type array/Collection.
This causes the child objects to be serialized directly inside the bean element.
This format must be used in conjunction with @Xml(childName) to differentiate which collection the values came from if you plan on parsing the output back into beans.
Note that child names must not conflict with other property names.
| Data type | JSON example | Without annotation | With annotation |
|---|---|---|---|
| | | |
See also
- @Xml(format) Annotation for the full list of
XmlFormatvalues. - @Xml(childName) Annotation for naming the collapsed child elements.
- Element & Mixed Formats for other ways to render collections.