https://kotlinlang.org logo
#jackson-kotlin
Title
# jackson-kotlin
k

kds

09/25/2018, 6:04 PM
Hi. I have a data class
Copy code
data class SID(
        @Pattern(regexp="[0-9a-zA-Z]{1,50}", message = "Недопустимые символы в SID")
        val sid: String
) {
    override fun toString(): String {
        return sid
    }
}
The jackson v. 2.9.7 shows me an error when I try to deserialize SID from string in message
Copy code
{
  "sid": "qweasdzxc",
  "date": 1537893098
}
Error:
Copy code
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `SID` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('qweasdzxc')
 at [Source: (String)"{
    "sid":"qweasdzxc",
    "date":1537893098,
...
h

hho

09/26/2018, 7:36 AM
Do you have the
jackson-module-kotlin
loaded?
3 Views