encoder

fun <T : @Serializable Any> encoder(clazz: KClass<T>, json: Json = defaultJson): ValueEncoder<T>(source)

Creates a ValueEncoder for a specified Kotlin class with optional JSON configuration.

Return

A ValueEncoder capable of serializing and deserializing instances of the specified class.

Parameters

clazz

The Kotlin class for which the encoder will be created. The class must be serializable.

json

The JSON configuration used for encoding and decoding. Defaults to defaultJson.