I'm making a JMAP client, and I'm not sure how to ...
# serialization
c
I'm making a JMAP client, and I'm not sure how to serialise the requests and responses. JMAP uses an
Invocation
form:
Copy code
data class Invocation(
    val name: String,
    val arguments: Response,
    val methodCallId: String
)
Here the
Response
is a sealed class with subclasses. When deserialising I'd like to discriminate the type of
Response
using the
name
field from
Invocation
. How can I do that?
a
I am not sure on what the ideal solution will be for this use-cae, but you can implement a
KSerializer
.