Is there a way to deserialize the following xml into Map holding List of items using Jackson?
<order>
<number>12345678</number>
<amount>100.10</amount>
<items>
<item>
<itemId>123</itemId>
<amount>100.0</amount>
<itemName>Item Name1</itemName>
</item>
<item>
<itemId>234</itemId>
<amount>200.00</amount>
<itemName>Item Name1</itemName>
</item>
</items>
</order>
I tried with
XmlMapper mapper = new XmlMapper();
LinkedHashMap map = (LinkedHashMap)mapper.readValue(xml, Object.class);
and got the following Map. The first item in the list is missing.
{
order={
number=12345678,
amount=100.1,
items={
item={
amount=200.0,
itemName=ItemName2,
itemId=234
}
}
}
}