mutate

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

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

The original is unchanged; the result is a freshly constructed JsonObject that reflects every assignment and removal performed inside the DSL block. See KpaStructMutationScope for the available to and remove operations.

Return

A new JsonObject with the mutations applied.

Parameters

block

A lambda with KpaStructMutationScope as receiver.


fun JsonArray.mutate(block: KpaListMutationScope.() -> Unit): JsonArray(source)

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

The original is unchanged; the result is a freshly constructed JsonArray that reflects every assignment and removal performed inside the DSL block. See KpaListMutationScope for the available to and remove operations.

Return

A new JsonArray with the mutations applied.

Parameters

block

A lambda with KpaListMutationScope as receiver.