-
-
Notifications
You must be signed in to change notification settings - Fork 230
Closed
Milestone
Description
Simple Test case: https://github.com/dewarim/jackson-xml-debug
Using jackson-dataformat-xml version 2.10.1 @ Java 11
Given: a POJO:
@JacksonXmlRootElement(localName = "Root")
@JsonRootName("Root")
public class Root {
@JsonProperty("id")
String id;
public Root(String id) {
this.id = id;
}
public Root() {
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Root root = (Root) o;
return Objects.equals(id, root.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}
When trying to do
ObjectMapper mapper = new XmlMapper();
mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
Root deserializedRoot = mapper.readValue(value, Root.class);
I get:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Root name 'id' does not match expected ('Root') for type [simple type, class test.debug.Root]
at [Source: (StringReader); line: 1, column: 7] (through reference chain: test.debug.Root["id"])
Metadata
Metadata
Assignees
Labels
No labels