api

http4k / org.http4k.format / ConfigurableGson

ConfigurableGson

open class ConfigurableGson : JsonLibAutoMarshallingJson<JsonElement> (source)

Constructors

Name Summary
<init> ConfigurableGson(builder: GsonBuilder)

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(): JsonElement
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
bool open fun bool(value: JsonElement): Boolean
elements open fun elements(value: JsonElement): Iterable<JsonElement>
fields open fun fields(node: JsonElement): Iterable<Pair<String, JsonElement>>
text open fun text(value: JsonElement): String
textValueOf open fun textValueOf(node: JsonElement, name: String): String!
typeOf open fun typeOf(value: JsonElement): JsonType

Inherited Functions

Name Summary
asA fun <T : Any> NODE.asA(): T
fun <T : Any> NODE.asA(target: KClass<T>): T
asJsonObject fun Any.asJsonObject(): NODE
asJsonString open fun asJsonString(input: Any): String

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

Inheritors

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