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
when json serialize, isXXX properties is deleted.
This bug has been fixed in 2.10.1, but it may have been degraded 2.11.x or higher. #346 #337
To Reproduce
create new project in IntellJ IDEA.
build.gradle.kts
dependencies {
implementation(kotlin("stdlib"))
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.11.+") // or 2.12.+
}
src/main/kotlin/Test.kt
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import java.lang.Exception
data class MyData(
@JsonProperty("id")
val id: String,
@JsonProperty("isValue")
val isValue: Int,
@JsonProperty("isStringValue")
val isStringValue: String
)
fun main() {
val jsonString = """
{ "id": "id001", "isValue": 1, "isStringValue": "20" }"
""".trimIndent()
val mapper = jacksonObjectMapper()
try {
val parseData: MyData = mapper.readValue(jsonString)
println("parseJson")
println(parseData)
val jsonData = mapper.writeValueAsString(parseData)
println("toJson")
println(jsonData)
} catch(e: Exception) {
e.printStackTrace()
}
}
Describe the bug
when json serialize, isXXX properties is deleted.
This bug has been fixed in 2.10.1, but it may have been degraded 2.11.x or higher.
#346
#337
To Reproduce
create new project in IntellJ IDEA.
build.gradle.kts
src/main/kotlin/Test.kt
resutls:
isXXX is deleted.
Expected behavior
change to 2.10.+
results:
isXXX is exists.
Versions
Kotlin: 1.4.30
Jackson-module-kotlin: 2.11.+, 2.12.+
Jackson-databind:
IntellJ IDEA: 2020.2.3
The text was updated successfully, but these errors were encountered: