api

http4k / org.http4k.format / ConfigurableKotlinxSerialization

ConfigurableKotlinxSerialization

open class ConfigurableKotlinxSerialization : AutoMarshallingJson<JsonElement>

Constructors

Name Summary
<init> ConfigurableKotlinxSerialization(json: JsonBuilder.() -> Unit, defaultContentType: ContentType = APPLICATION_JSON)

Properties

Name Summary
defaultContentType val defaultContentType: ContentType
json val json: Json

Functions

Name Summary
asA open fun <T : Any> asA(j: JsonElement, target: KClass<T>): T
open fun <T : Any> asA(input: String, target: KClass<T>): T
fun <T : Any> JsonElement.asA(): T
asCompactJsonString open fun JsonElement.asCompactJsonString(): String
asJsonArray open fun <T : Iterable<JsonElement>> T.asJsonArray(): JsonArray
asJsonObject open fun String.asJsonObject(): JsonObject
open fun <LIST : Iterable<Pair<String, JsonElement>>> LIST.asJsonObject(): JsonObject
open fun asJsonObject(input: Any): JsonElement
asJsonValue open fun String?.asJsonValue(): JsonPrimitive
open fun Int?.asJsonValue(): JsonPrimitive
open fun Double?.asJsonValue(): JsonPrimitive
open fun Long?.asJsonValue(): JsonPrimitive
open fun BigDecimal?.asJsonValue(): JsonPrimitive
open fun BigInteger?.asJsonValue(): JsonPrimitive
open fun Boolean?.asJsonValue(): JsonPrimitive
asPrettyJsonString open fun JsonElement.asPrettyJsonString(): String
autoBody fun <T : Any> autoBody(description: String? = null, contentNegotiation: ContentNegotiation = None, contentType: ContentType = defaultContentType): <ERROR CLASS>
bool open fun bool(value: JsonElement): Boolean
decimal open fun decimal(value: JsonElement): BigDecimal
elements open fun elements(value: JsonElement): Collection<JsonElement>
fields open fun fields(node: JsonElement): List<Pair<String, JsonElement>>
integer open fun integer(value: JsonElement): Long
text open fun text(value: JsonElement): String
textValueOf open fun textValueOf(node: JsonElement, name: String): String?
typeOf open fun typeOf(value: JsonElement): JsonType

Companion Object Functions

Name Summary
auto fun <T : Any> WsMessage.Companion.auto(): BiDiWsMessageLensSpec<T>
fun <T : Any> Body.Companion.auto(description: String? = null, contentNegotiation: ContentNegotiation = None, contentType: ContentType = defaultContentType): <ERROR CLASS>

Extension Functions

Name Summary
hasBody fun <NODE> Json<NODE>.hasBody(expected: NODE): Matcher<HttpMessage>
fun <NODE> Json<NODE>.hasBody(expected: Matcher<NODE>): Matcher<HttpMessage>
fun <NODE> Json<NODE>.hasBody(expected: String): Matcher<HttpMessage>
haveBody fun <NODE> Json<NODE>.haveBody(expected: NODE): Matcher<HttpMessage>
fun <NODE> Json<NODE>.haveBody(expected: Matcher<NODE>): Matcher<HttpMessage>
fun <NODE> Json<NODE>.haveBody(expected: String): Matcher<HttpMessage>

Inheritors

Name Summary
KotlinxSerialization To implement custom JSON configuration, create your own object singleton extending ConfigurableKotlinxSerialization, passing in the JSON configuration blockobject KotlinxSerialization : ConfigurableKotlinxSerialization