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
Describe the bug
An object with a camelCased property, which starts with a single lowercase character isn't properly serialized.
To Reproduce
funmain(args:Array<String>) {
val mapper = jacksonObjectMapper()
val serialized = mapper.writeValueAsString(Test())
println(serialized)
val deserialized = mapper.readValue<Test>(serialized)
}
classTest {
val cCase =1
}
Expected behavior
The property should be correctly serialized as cCase but it is serialized as ccase.
So the provided code snippet prints the string {"ccase":1} instead of {"cCase":1}
Because of this behavior the deserialization fails with the following error:
Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "ccase" (class de.nilswieber.Test), not marked as ignorable (0 known properties: ])
at [Source: (String)"{"ccase":1}"; line: 1, column: 11] (through reference chain: de.nilswieber.Test["ccase"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:1127)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:2023)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1700)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1678)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:319)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:176)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4674)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3629)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3612)
at de.nilswieber.MainKt.main(Main.kt)
The issue of property names in the serialization result differing from the definition in Kotlin will be addressed in #630.
This issue be closed as a duplicate.
Describe the bug
An object with a camelCased property, which starts with a single lowercase character isn't properly serialized.
To Reproduce
Expected behavior
The property should be correctly serialized as
cCase
but it is serialized asccase
.So the provided code snippet prints the string
{"ccase":1}
instead of{"cCase":1}
Because of this behavior the deserialization fails with the following error:
Versions
Kotlin:
Jackson-module-kotlin: 2.13.3
Jackson-databind: 2.13.3
Additional context
This issue is likely related to #172 and #173
The text was updated successfully, but these errors were encountered: