encodeToByteArray

abstract fun <T> encodeToByteArray(serializer: SerializationStrategy<T>, value: T): ByteArray(source)

Serializes and encodes the given value to byte array using the given serializer.

Throws

in case of any encoding-specific error

if the encoded input does not comply format's specification