Search code examples
javajacksonjackson-dataformat-xml

Jackson XML parser fails when tags


The Jackson XML parser fails when there occurs attributes like this:

<some-float-value fr:relevance="true">99</some-float-value>

the error log look like this:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.Float` out of START_OBJECT token

if I delete the Attribute, so the field look like this, it goes okay:

<some-float-value>99</some-float-value>

The class I want to parse to is like this:

@JsonIgnoreProperties(ignoreUnknown = true)
public class Example {
    @JacksonXmlProperty(localName = "some-float-value")
    private Float someValue;
}

Solution

  • Solve by bumping from Jackson version 2.11.3 to 2.12.3