https://kotlinlang.org logo
x

xxfast

10/13/2022, 4:37 AM
Re: closed-polymorphic type serialisation, are we able to change the key
type
field to something else? to achieve something like
Copy code
{
  "typeKey": "owned",
  "status": "open",
  "name": "kotlinx.coroutines",
  "owner": "kotlin"
}
1
z

zt

10/13/2022, 4:43 AM
In your Json configuration you can do this, so:
Copy code
Json {
    classDiscriminator = "typeKey"
}
x

xxfast

10/13/2022, 5:23 AM
you cant set it up for each type, can you?
e

ephemient

10/13/2022, 6:54 AM
4 Views