serialize

abstract fun <T : Any> serialize(obj: T, context: SerializationContext): SerializedBytes<T>

Serialize an object to bytes using the preferred serialization format version from the context.

Parameters

obj

The object to be serialized.

context

A context that configures various parameters to serialization, including the serialization format version.