Package-level declarations

Types

Link copied to clipboard
open class TypedSerializer<T : Any>(kClass: KClass<T>, presetSerializers: Map<String, KSerializer<out T>> = emptyMap()) : KSerializer<T>

A serializer that includes type information in the serialized output. This allows polymorphic serialization where the exact type is preserved in the output as a "type" field alongside the "value" field.

Functions

Link copied to clipboard
@InternalSerializationApi
operator fun <T : Any> TypedSerializer<T>.minusAssign(kClass: KClass<T>)

Removes a type from this TypedSerializer using its class name.

Link copied to clipboard
@InternalSerializationApi
operator fun <T : Any> TypedSerializer<T>.plusAssign(kClass: KClass<T>)

Adds a type to this TypedSerializer using its class name as the type identifier.

Link copied to clipboard
inline fun <T : Any> TypedSerializer(presetSerializers: Map<String, KSerializer<out T>> = emptyMap()): TypedSerializer<T>

Creates a TypedSerializer for the reified type T.

inline fun <T : Any> TypedSerializer(vararg presetSerializers: Pair<String, KSerializer<out T>>): TypedSerializer<T>

Creates a TypedSerializer for the reified type T with vararg preset serializers.