← Back to Kairo Docs|API Reference (Dokka)

KairoJson

class KairoJson

A wrapper around Jackson's JsonMapper.

Has stricter and less surprising defaults than native Jackson, but you can still override them the same way you would for Jackson.

Serialization and deserialization retain type information, reducing surprises like polymorphic type information not being included when serializing the type directly.

Supports Kotlin's nullability guarantees.

Types

Link copied to clipboard
class Builder
Link copied to clipboard

You must opt in to access the raw JsonMapper.

Properties

Link copied to clipboard
val delegate: JsonMapper

Functions

Link copied to clipboard
fun <T> checkResult(result: T?, type: KairoType<T>)

Ensures that the result matches the expected type. The primary purpose is shim support for Kotlin's nullability guarantees.

Link copied to clipboard
fun copy(configure: JsonMapper.Builder.() -> Unit): KairoJson
Link copied to clipboard
inline fun <T> deserialize(string: String): T
fun <T> deserialize(string: String, type: KairoType<T>): T
Link copied to clipboard
inline fun <T> inputStream(inputStream: InputStream): T
fun <T> inputStream(inputStream: InputStream, type: KairoType<T>): T
Link copied to clipboard
inline fun <T> KairoJson.jsonGenerator(jsonGenerator: JsonGenerator, value: T?)
fun <T> KairoJson.jsonGenerator(jsonGenerator: JsonGenerator, value: T?, type: KairoType<T>)
Link copied to clipboard
inline fun <T> outputStream(outputStream: OutputStream, value: T?)
fun <T> outputStream(outputStream: OutputStream, value: T?, type: KairoType<T>)
Link copied to clipboard
inline fun <T> KairoJson.reader(reader: Reader): T
fun <T> KairoJson.reader(reader: Reader, type: KairoType<T>): T
Link copied to clipboard
inline fun <T> serialize(value: T?): String
fun <T> serialize(value: T?, type: KairoType<T>): String