'Jackson xml mapper wraps generic list elements into a listname extra tag
I'm stuck on a wrong XML serialization I'm obtaining with Jackson XML mapper serializer. I have a generic RESULT TAG that must contain some other elements, and these elements may be lists of elements, something like this:
<RESULT>
<THINGS>
<THING>
<SOMETHING_ABOUT_THING>001</SOMETHING_ABOUT_THING>
</THING>
<THING>
<SOMETHING_ABOUT_THING>002</SOMETHING_ABOUT_THING>
</THING>
</THINGS>
</RESULT>
But what I'm obtaining through standard XML mapper is something with an extra tag like this:
<RESULT>
<THINGS>
<THING>
<SOMETHING_ABOUT_THING>001</SOMETHING_ABOUT_THING>
</THING>
</THINGS>
<THINGS>
<THING>
<SOMETHING_ABOUT_THING>002</SOMETHING_ABOUT_THING>
</THING>
</THINGS>
</RESULT>
I do not have any custom object, because tag names and tag content are dynamically retrieved from a database, I'm just working with an HashMap, and trying to serialize it. The hashmap holds a single THINGS key that contains as value a list of maps, and each map contains a single THING element.
What can I do to achieve the first result?
Thanks in advance
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
