Kotlinx.serialization: Polymorphic deserialization `type` field

Created on 4 Apr 2020  路  1Comment  路  Source: Kotlin/kotlinx.serialization

Currently the expected value of type field is the canonical name of sub classes. Is it possible to customize this value?

ps: Subclass name or ParentClass.SubClass might be better choices for this value. The way it is moving your model class to another package breaks the api with clients.

feature json

Most helpful comment

Not yet, but we are considering adding this.
As a workaround, you can change the canonical name of the class by annotation it with @SerialName annotation

>All comments

Not yet, but we are considering adding this.
As a workaround, you can change the canonical name of the class by annotation it with @SerialName annotation

Was this page helpful?
0 / 5 - 0 ratings