JSONRPCResponseSerializer

class JSONRPCResponseSerializer<T, E>(resultSerializer: KSerializer<T>, errorDataSerializer: KSerializer<E>) : KSerializer<JSONRPCResponse<T, E>> (source)

Content-based polymorphic serializer for JSONRPCResponse.

Discriminates between JSONRPCResponse.Success and JSONRPCResponse.Error based on the presence of the "error" or "result" field in the JSON object.

Parameters

resultSerializer

Serializer for the result field.

errorDataSerializer

Serializer for the error's data field.

Type Parameters

T

The type of the result value in JSONRPCResponse.Success.

E

The type of the error data in JSONRPCResponse.Error.

Constructors

Link copied to clipboard
constructor(resultSerializer: KSerializer<T>, errorDataSerializer: KSerializer<E>)

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): JSONRPCResponse<T, E>
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: JSONRPCResponse<T, E>)