i have a test in which i feed
"{"type": "A", ...}"
into a
PolymorphicType.A.serializer()
it fails with a
Unexpected JSON token at offset 11: Encountered an unknown key 'type'.
is there a way to skip that.. while also not adding
type
as a property to the class (because that creates other issue)
or using
ignoreUnknownKeys = true
because there could be other.. issues ?
oone way i found was to use
val a = Json.decodeFromString(PolymorphicType.serializer(), jsonString) as PolymorphicType.A
but that means that there is no way to use this.. except for encoding and decoding using the polymorphic types.. or you wil lose the
type
properties