Answer the question
In order to leave comments, you need to log in
Jackson converting to json and back to date class?
In general, I converted to json like this:
val user = User("test",999888)
val om = ObjectMapper().writeValueAsString(user)
//ошибка
val u2:User = ObjectMapper().readValue<User>(om,object:TypeReference<User>(){})
Answer the question
In order to leave comments, you need to log in
you need to add the jackson-module-kotlin dependency.
object:TypeReference(){] is not needed, just add an annotation to the @JasonCreator class constructor and each field @JasonProperty("name") .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question