Hello!
Please, consider following test case:
/** Two lists */
public static final String TEST_TWO_LISTS =
" <Wrapper>" +
" <ones> " +
" <name>item0</name>" +
" <name>item1</name>" +
" </ones>" +
" <twos>" +
" <name>item2</name>" +
" <name>item3</name>" +
" </twos>" +
" </Wrapper>";
static class Wrapper {
@JacksonXmlElementWrapper(localName = "ones")
@JacksonXmlProperty(localName = "name")
public List<String> ones;
@JacksonXmlElementWrapper(localName = "twos")
@JacksonXmlProperty(localName = "name")
public List<String> twos;
}
@Test
public void shouldHandleNestedListsWithObjects() throws IOException {
ObjectMapper xmlMapper = new XmlMapper();
Wrapper wrapper = xmlMapper.readValue(TEST_TWO_LISTS, Wrapper.class);
assertNotNull(wrapper);
}
This test fails with error:
com.fasterxml.jackson.databind.JsonMappingException: Multiple fields representing property "name"
Is this a known is a known issue and may I handle this situation without need for two extra classes (Ones and Twos)?
Hello!
Please, consider following test case:
This test fails with error:
com.fasterxml.jackson.databind.JsonMappingException: Multiple fields representing property "name"Is this a known is a known issue and may I handle this situation without need for two extra classes (Ones and Twos)?