You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deserialization fails with 'Unrecognized field ...' for a boolean property of a class with a super class with a matching boolean property starting with 'is'
#359
Closed
AntipovAndrey opened this issue
Aug 19, 2020
· 1 comment
Describe the bug
The following code works as expected with 2.9.10 version of the module.
To Reproduce
openclassBaseResult(valisSuccess:Boolean)
classDerivedResult(valsuccess:Boolean) : BaseResult(success)
funmain() {
val json =""" { "success": true }""".trimIndent()
val mapper =ObjectMapper()
mapper.registerModule(KotlinModule())
assert(mapper.readValue<DerivedResult>(json).success)
}
Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "success" (class DerivedResult), not marked as ignorable (one known property: "isSuccess"])
at [Source: (String)"{
"success": true
}"; line: 3, column: 2] (through reference chain: DerivedResult["success"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:855)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1212)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1604)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperties(BeanDeserializerBase.java:1554)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:511)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1322)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:331)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:164)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4524)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3466)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3449)
at SampleKt.main(Sample.kt:21)
Describe the bug
The following code works as expected with 2.9.10 version of the module.
To Reproduce
Expected behavior
No failure
Versions
Kotlin: 1.3.72
Jackson-module-kotlin: 2.11.2
Jackson-databind: 2.11.2
Additional context
Caused by #80
The text was updated successfully, but these errors were encountered: