api

http4k / org.http4k.format / Gson

Gson

object Gson : ConfigurableGson (source)

To implement custom JSON configuration, create your own object singleton. Extra mappings can be added before done() is called.

Inherited Properties

Name Summary
mapper val mapper: Gson

Inherited Functions

Name Summary
asA open fun <T : Any> asA(input: String, target: KClass<T>): T
open fun <T : Any> asA(j: JsonElement, target: KClass<T>): T
asCompactJsonString open fun JsonElement.asCompactJsonString(): String
asJsonArray open fun <T : Iterable<JsonElement>> T.asJsonArray(): JsonElement
asJsonObject open fun String.asJsonObject(): JsonElement
open fun <LIST : Iterable<Pair<String, JsonElement>>> LIST.asJsonObject(): JsonObject
open fun asJsonObject(input: Any): JsonElement
asJsonValue open fun String?.asJsonValue(): JsonElement
open fun Int?.asJsonValue(): JsonElement
open fun Double?.asJsonValue(): JsonElement
open fun Long?.asJsonValue(): JsonElement
open fun BigDecimal?.asJsonValue(): JsonElement
open fun BigInteger?.asJsonValue(): JsonElement
open fun Boolean?.asJsonValue(): JsonElement
asPrettyJsonString open fun JsonElement.asPrettyJsonString(): String
autoBody fun <T : Any> autoBody(description: String? = null, contentNegotiation: ContentNegotiation = None): BiDiBodyLensSpec<T>
bool open fun bool(value: JsonElement): Boolean
decimal open fun decimal(value: JsonElement): BigDecimal
elements open fun elements(value: JsonElement): Iterable<JsonElement>
fields open fun fields(node: JsonElement): Iterable<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

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>
with fun <T> T.with(vararg modifiers: (T) -> T): T