Dominaezzz
04/27/2021, 5:57 PMinterface Animal
@Serializable
class Dog : Animal
@Serializable
class Cat : Animal
// subclasses are explicitly registered in serializerModule.
client.get<...>("...") {
contentType(Json)
body = Dog()
}
How do I get ktor to do polymorphic serialisation correctly?
body
ends up being {}
instead of { "type": "Dog" }
.Big Chungus
04/27/2021, 6:33 PMDominaezzz
04/27/2021, 6:39 PM@Serializable
, was just impatient when writing the code lol.Big Chungus
04/27/2021, 6:40 PMDominaezzz
04/27/2021, 6:41 PMBig Chungus
04/27/2021, 6:42 PMDominaezzz
04/27/2021, 6:42 PMalex009
04/28/2021, 2:01 AM