zt
08/21/2024, 3:18 AMtype
field? I do not want polymorphism here as the type is determined by the structure. Is there some way around this?
@Serializable
interface Base {
val a: Int
}
// should serialize to { "a": 10, "b": 10 }
@Serializable
data class A(override val a: Int, val b: Int) : Base
// should serialize to { "a": 10, "c": 10 }
@Serializable
data class B(override val a: Int, val c: Int) : Base
Vampire
08/21/2024, 6:55 AM