SerializationConverter

class SerializationConverter : ContentConverter

ContentConverter with kotlinx.serialization.

Installation:

install(ContentNegotiation) {
json()
json(ContentType.Application.Json, Json.nonstrict)
cbor()
protoBuf()
}

Constructors

Link copied to clipboard
fun SerializationConverter(format: BinaryFormat)

Creates a converter serializing with the specified binary format.

Link copied to clipboard
fun SerializationConverter(format: StringFormat, defaultCharset: Charset = Charsets.UTF_8)

Creates a converter serializing with the specified string format and defaultCharset (optional, usually it is UTF-8).

Link copied to clipboard
fun SerializationConverter(json: Json = DefaultJson)
Link copied to clipboard
fun SerializationConverter()

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

Functions

Link copied to clipboard
open suspend override fun convertForReceive(context: PipelineContext<ApplicationReceiveRequest, ApplicationCall>): Any?
Link copied to clipboard
open suspend override fun convertForSend(context: PipelineContext<Any, ApplicationCall>, contentType: ContentType, value: Any): Any?