ktor-serialization / io.ktor.serialization / io.ktor.features.ContentNegotiation.Configuration / json

json

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

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

Parameters

json - configuration with settings such as quoting, pretty print and so on (optional)

module - is used for serialization (optional)

contentType - to register with, application/json by default

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.

Parameters

json - format instance (optional)

contentType - to register with, application/json by default