Closed
Description
I have an object with a map field and I want to map it to a XML file. However, the resulting XML file does not contains pairs like normal XML. Instead, it treat each key as a data type and each value as the value of that data type. For example, I have
class MyObject {
private final Map<String, Integer> myMap;
public MyObject() {
myMap = new HashMap<>();
myMap.put("a", 1);
myMap.put("b", 2);
// Getter
}
I get
<myMap>
<a>1</a>
<b>2</b>
</myMap>
But it is supposed to be
<myMap>
<entry>
<key>a</key>
<value>1</value>
</entry>
<entry>
<key>b</key>
<value>2</value>
</entry>
</myMap>
Do you know how to solve this issue?
Metadata
Metadata
Assignees
Labels
No labels