Please consider to use annotation parameters only to achieve backward compatibility. Otherwise feel free to file issues about serialization cosmetics.

Lists and Sets

XCollection annotation intended to customize list and set serialization.

Two styles are provided:

Where second-level option it is item element (use elementName to customize element name) and value it is value attribute (use valueAttributeName to customize attribute name).

Because of backward compatibility, v1 style is used by default. In the examples v2 style is used.

Custom List Item Value Attribute Name

Value of primitive type wrapped into element named option. valueAttributeName allows you to customize name of value attribute.

Empty name is allowed — in this case value will be serialized as element text.

Maps

XMap annotation intended to customize map serialization and to enable new serialization format.

So, it is recommended to always specify XMap annotation.