hi,
how can I choose a type based on a string parameter,
for example I have such object for type A:
Copy code
{
"type": "A",
"field": "foo"
}
and such for type B:
Copy code
{
"type": "B",
"foo": "bar"
}
how to differentiate
@Serializable
classes based on the
type
field?
the classes I currently have are as follows:
Copy code
@Serializable
sealed class Message {
@Serializable data class A(field: String, type: String): Message()
@Serializable data class B(foo: String, type: String): Message()
}