Package io.ktor.serialization

Types

SerializationConverter

class SerializationConverter : ContentConverter

ContentConverter with kotlinx.serialization.

Properties

DefaultJson

val DefaultJson: Json

The default json configuration used in SerializationConverter. The settings are:

DefaultJsonConfiguration

val DefaultJsonConfiguration: Json

The default json configuration used in SerializationConverter. The settings are:

Functions

SerializationConverter

fun SerializationConverter(): SerializationConverter

This is no longer supported. Instead, specify format explicitly or use the corresponding DSL function.

json

fun Configuration.json(
    json: Json = Json.Default,
    module: SerializersModule = EmptySerializersModule,
    contentType: ContentType = ContentType.Application.Json
): Unit
fun Configuration.json(
    json: Json = DefaultJson,
    contentType: ContentType = ContentType.Application.Json
): Unit

Register application/json (or another specified contentType) content type to ContentNegotiation feature using kotlinx.serialization.

serialization

fun Configuration.serialization(
    contentType: ContentType,
    format: BinaryFormat
): Unit

Register kotlinx.serialization converter into ContentNegotiation feature with the specified contentType and binary format (such as CBOR, ProtoBuf)

fun Configuration.serialization(
    contentType: ContentType,
    format: StringFormat
): Unit

Register kotlinx.serialization converter into ContentNegotiation feature with the specified contentType and string format (such as Json)

fun Configuration.serialization(): Unit
fun Configuration.serialization(
    contentType: ContentType
): Unit
fun Configuration.serialization(
    contentType: ContentType,
    json: Json
): Unit

Register kotlinx.serialization converter into ContentNegotiation feature

serialization0

fun Configuration.serialization0(
    contentType: ContentType = ContentType.Application.Json,
    json: Json = DefaultJson
): Unit