【发布时间】:2019-11-27 22:14:04
【问题描述】:
我正在尝试向数据库中插入一些数据,但出现以下错误:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `org.joda.time.DateTime` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('2019-04-19')
我的内容协商
install(ContentNegotiation) {
jackson {
enable(SerializationFeature.INDENT_OUTPUT)
}
}
还有我的模特:
data class User(
//some codes
val registrationDate = DateTime // org.joda.time.DateTime
)
我什么时候会通过 json 发送:
{
//some other data
"registrationDate" : "2019-07-15"
}
有人可以帮帮我吗?
【问题讨论】:
标签: serialization kotlin ktor kotlin-exposed