get

operator fun JsonArray.get(pointer: JsonPointer): JsonElement?(source)

Returns the JsonElement at the location identified by pointer, or null if pointer is the root pointer and this function returns the array itself.

If pointer is the root pointer, returns this. Otherwise pops the first segment, converts it to an Int array index (throwing IllegalStateException if the segment is not a valid non-negative integer), and traverses recursively. An out-of-range index throws IndexOutOfBoundsException. An intermediate segment that resolves to a JSON primitive throws IllegalStateException.

Return

The JsonElement at the specified path, or this if pointer is the root pointer.

Receiver

The JsonArray to traverse.

Parameters

pointer

The JsonPointer identifying the value to retrieve.

Throws

if a segment is not a valid array index or an intermediate resolves to a primitive.

if an array index is out of range.


operator fun JsonObject.get(pointer: JsonPointer): JsonElement?(source)

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

If pointer is the root pointer, returns this. Otherwise navigates each segment in turn: an absent key at any level returns null, and a segment that lands on a JSON primitive (when further navigation is required) throws IllegalStateException.

Return

The JsonElement at the specified path, or null if a key along the path is absent.

Receiver

The JsonObject to traverse.

Parameters

pointer

The JsonPointer identifying the value to retrieve.

Throws

if an intermediate segment resolves to a JSON primitive.