hello 👋
has anyone tried
value class
with jackson?
fun main() {
val string = ObjectMapper().findAndRegisterModules()
.convertValue<Map<String, String>>(Value("any"))
println(string)
}
@JvmInline
value class Value(val value: String)
prints
{value=any}
with jackson 2.12.5, but fails with jackson 2.13.0. error is
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('any')
at [Source: UNKNOWN; byte offset: #UNKNOWN]
though
https://github.com/FasterXML/jackson-module-kotlin/issues/464 makes me wonder if my expectation is wrong. my use case is the one marked as “broken”:
"broken": [ {"value":0}, {"value":0} ]
, though this is exactly what I want