Package-level declarations

Types

Link copied to clipboard
class JsonArrayAdapter(val backing: JsonArray) : JsonElementAdapter, KpaList

Adapter exposing a JsonArray as a KpaList.

Link copied to clipboard

Common interface for all kxs adapters, exposing the underlying JsonElement.

Link copied to clipboard

The single KpaElementFactory shared by every kxs adapter.

Link copied to clipboard
class JsonObjectAdapter(val backing: JsonObject) : JsonElementAdapter, KpaStruct

Adapter exposing a JsonObject as a KpaStruct.

Link copied to clipboard
class JsonPrimitiveAdapter(val backing: JsonPrimitive) : JsonElementAdapter, KpaPrimitive

Adapter exposing a JsonPrimitive (including JsonNull) as a KpaPrimitive.

Functions

Link copied to clipboard
fun JsonElement.arrayAt(pointer: KPointer): JsonArray?

Returns the JsonArray at pointer, or null if the path is absent.

fun JsonElement.arrayAt(path: String): JsonArray?

Parses path via KPointer.from and returns the JsonArray at that path, or null if absent.

Link copied to clipboard
fun JsonArray.asKpaList(): JsonArrayAdapter

Wraps this JsonArray in a JsonArrayAdapter.

Link copied to clipboard
fun JsonObject.asKpaStruct(): JsonObjectAdapter

Wraps this JsonObject in a JsonObjectAdapter.

Link copied to clipboard
operator fun JsonElement.contains(pointer: KPointer): Boolean

Returns whether the path identified by pointer resolves to a value within this element.

Link copied to clipboard
fun JsonElement.elementAt(pointer: KPointer): JsonElement?

Returns the JsonElement at the path identified by pointer, or null if a key along the path is absent.

fun JsonElement.elementAt(path: String): JsonElement?

Parses path via KPointer.from and returns the JsonElement at that path, or null if absent.

Link copied to clipboard
operator fun JsonElement.get(pointer: KPointer): JsonElement?

Returns the JsonElement at the path identified by pointer, or null if a key along the path is absent.

Link copied to clipboard
fun JsonArray.mutate(block: KpaListMutationScope.() -> Unit): JsonArray

Applies pointer-based mutations to this JsonArray within block, returning a new JsonArray.

fun JsonObject.mutate(block: KpaStructMutationScope.() -> Unit): JsonObject

Applies pointer-based mutations to this JsonObject within block, returning a new JsonObject.

Link copied to clipboard
fun JsonElement.objectAt(pointer: KPointer): JsonObject?

Returns the JsonObject at pointer, or null if the path is absent.

fun JsonElement.objectAt(path: String): JsonObject?

Parses path via KPointer.from and returns the JsonObject at that path, or null if absent.

Link copied to clipboard
fun JsonElement.primitiveAt(pointer: KPointer): JsonPrimitive?

Returns the JsonPrimitive at pointer, or null if the path is absent.

fun JsonElement.primitiveAt(path: String): JsonPrimitive?

Parses path via KPointer.from and returns the JsonPrimitive at that path, or null if absent.

Link copied to clipboard
fun KpaElement.toJsonElement(): JsonElement

Returns the JsonElement backing this adapter, or throws if this is not a JsonElementAdapter.

Link copied to clipboard
fun JsonElement.toKpaElement(): KpaElement

Wraps this JsonElement in the appropriate JsonElementAdapter.