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

rawtoast

02/27/2018, 11:01 AM
Unfortunately, those annotations require the inclusion of the type information in the response.
k

krotki

02/27/2018, 1:07 PM
I'm not sure what you want to achieve, but usually you have to know a type to interpret JSON corectly. Based on your test I think you want to determine class by unique field for that type ? If so have a look here: https://gist.github.com/robinhowlett/ce45e575197060b8392d
r

rawtoast

02/27/2018, 6:29 PM
That might do the job. It looks like using jackson to consume form a polymorphic endpoint like that may not be a wise idea (complexity). In Scala, I can declare a set of sealed case classes in the same manner as the sealed data classes in Kotlin. The JSON parsing libraries do not require any type field in order to parse to the abstract types.
3 Views