serialize

override fun serialize(encoder: Encoder, value: Zero)

Serializes the specified value using the format represented by the specified encoder.

See the KSerializer.serialize method for more details.


Calling from Kotlin

Here's an example of calling this method from Kotlin code:

val serializer = ZeroAsByteSerializer()
val zero = Zero()
val encoded: String = Json.encodeToString(serializer, zero)
val expected: String = zero.toByte()
.let(Json.Default::encodeToString)
assertEquals(expected, encoded)