The documentation here shows that when serializing an object that implements an interface, as long as the subclass is @Serializable, it will be able to serialize it. However, this serializes a number of properties that are on the subclass that I don't want to be serialized.
example:
interface Test {
val prop1 : String
val prop2 : String
}
@Serializable
class TestImpl(
override var prop1,
override var prop2,
) : Request {
var dontWantSerialized = 0
}
When I serialize this, the property "dontWantSerialized" ends up in the json as well. I want to create a json payload with only the properties from the interface. Is this possible? I would also not like it to require the "type" property as well, since I only expect one implementation of the interface within the compilation unit. Is there any way to accomplish this with kotlinx serialization?