Package-level declarations

Serializers for standard Kotlin types, like Int, String, List, etc.

Types

Link copied to clipboard

Serializer that encodes and decodes Long as its string representation.

Properties

Link copied to clipboard

Returns a nullable serializer for the given serializer of non-null type.

Functions

Link copied to clipboard
inline fun <T : Any, E : T?> ArraySerializer(elementSerializer: KSerializer<E>): KSerializer<Array<E>>
fun <T : Any, E : T?> ArraySerializer(kClass: KClass<T>, elementSerializer: KSerializer<E>): KSerializer<Array<E>>

Returns serializer for reference Array of type E with descriptor of StructureKind.LIST kind. Each element of the array is serialized with the given elementSerializer.

Link copied to clipboard

Returns serializer for BooleanArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with Boolean.Companion.serializer.

Link copied to clipboard

Returns serializer for ByteArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with Byte.Companion.serializer.

Link copied to clipboard

Returns serializer for CharArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with Char.Companion.serializer.

Link copied to clipboard

Returns serializer for DoubleArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with Double.Companion.serializer.

Link copied to clipboard

Returns serializer for FloatArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with Float.Companion.serializer.

Link copied to clipboard

Returns serializer for IntArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with Int.Companion.serializer.

Link copied to clipboard
fun <T> ListSerializer(elementSerializer: KSerializer<T>): KSerializer<List<T>>

Creates a serializer for List<T> for the given serializer of type T.

Link copied to clipboard

Returns serializer for LongArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with Long.Companion.serializer.

Link copied to clipboard
fun <K, V> MapEntrySerializer(keySerializer: KSerializer<K>, valueSerializer: KSerializer<V>): KSerializer<Map.Entry<K, V>>

Returns built-in serializer for Map.Entry. Resulting serializer represents entry as a structure with a single key-value pair. E.g. Pair(1, 2) and Map.Entry(1, 2) will be serialized to JSON as {"first": 1, "second": 2} and {"1": 2} respectively.

Link copied to clipboard
fun <K, V> MapSerializer(keySerializer: KSerializer<K>, valueSerializer: KSerializer<V>): KSerializer<Map<K, V>>

Creates a serializer for Map<K, V> for the given serializers for its key type K and value type V.

Link copied to clipboard

Returns serializer for Nothing. Throws an exception when trying to encode or decode.

Link copied to clipboard
fun <K, V> PairSerializer(keySerializer: KSerializer<K>, valueSerializer: KSerializer<V>): KSerializer<Pair<K, V>>

Returns built-in serializer for Kotlin Pair. Resulting serializer represents pair as a structure of two key-value pairs.

Link copied to clipboard
fun <Error class: unknown class>.serializer(): KSerializer<<Error class: unknown class>>

Returns serializer for Uuid. Serializer operates with a standard UUID string representation, also known as "hex-and-dash" format — RFC 9562 section 4.

Returns serializer for Boolean with descriptor of PrimitiveKind.BOOLEAN kind.

Returns serializer for Byte with descriptor of PrimitiveKind.BYTE kind.

Returns serializer for Char with descriptor of PrimitiveKind.CHAR kind.

Returns serializer for Double with descriptor of PrimitiveKind.DOUBLE kind.

Returns serializer for Float with descriptor of PrimitiveKind.FLOAT kind.

Returns serializer for Int with descriptor of PrimitiveKind.INT kind.

Returns serializer for Long with descriptor of PrimitiveKind.LONG kind.

Returns serializer for Short with descriptor of PrimitiveKind.SHORT kind.

Returns serializer for String with descriptor of PrimitiveKind.STRING kind.

Returns serializer for UByte.

Returns serializer for UInt.

Returns serializer for ULong.

Returns serializer for UShort.

Returns serializer for Unit with descriptor of StructureKind.OBJECT kind.

Returns serializer for Duration. It is serialized as a string that represents a duration in the ISO-8601-2 format.

Link copied to clipboard
fun <T> SetSerializer(elementSerializer: KSerializer<T>): KSerializer<Set<T>>

Creates a serializer for Set<T> for the given serializer of type T.

Link copied to clipboard

Returns serializer for ShortArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with Short.Companion.serializer.

Link copied to clipboard
fun <A, B, C> TripleSerializer(aSerializer: KSerializer<A>, bSerializer: KSerializer<B>, cSerializer: KSerializer<C>): KSerializer<Triple<A, B, C>>

Returns built-in serializer for Kotlin Triple. Resulting serializer represents triple as a structure of three key-value pairs.

Link copied to clipboard

Returns serializer for UByteArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with UByte.Companion.serializer.

Link copied to clipboard

Returns serializer for UIntArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with UInt.Companion.serializer.

Link copied to clipboard

Returns serializer for ULongArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with ULong.Companion.serializer.

Link copied to clipboard

Returns serializer for UShortArray with descriptor of StructureKind.LIST kind. Each element of the array is serialized one by one with UShort.Companion.serializer.