JsonPointer

Represents a JSON Pointer as defined in RFC 6901.

A JSON Pointer is a string that identifies a specific value within a JSON document using an array of reference tokens. Segments are separated by '/' and may contain '~' (for escaping) characters.

Relative JSON Pointers (draft-bhutton-relative-json-pointer-00) are supported via the plus operator, which accepts a relative pointer string and returns a RelativePointerResult. The minus operator computes the relative pointer string that navigates from this pointer to another.

Types

Link copied to clipboard
object Companion

Companion object for creating JsonPointer instances and providing constants.

Properties

Link copied to clipboard
val depth: Int

Returns the number of path segments in this pointer.

Link copied to clipboard

Checks if this pointer is the root pointer.

Link copied to clipboard

Returns the parent pointer of this pointer.

Functions

Link copied to clipboard
operator fun get(index: Int): String

Returns the path segment at the specified index.

Link copied to clipboard
fun getSegment(index: Int): String

Returns the path segment at the specified index.

Link copied to clipboard
operator fun minus(other: JsonPointer): String

Returns the Relative JSON Pointer string that navigates from this pointer to other.

Link copied to clipboard
operator fun plus(other: JsonPointer): JsonPointer

Concatenates this pointer with another pointer, creating a new pointer with combined segments.

operator fun plus(other: String): RelativePointerResult

Applies a Relative JSON Pointer (draft-bhutton-relative-json-pointer-00) to this pointer.

Link copied to clipboard

Pops the first segment from this pointer, returning both the segment and a new pointer without that segment.

Link copied to clipboard

Returns the dot-notation string representation of this pointer.

Link copied to clipboard

Returns the URI fragment identifier representation of this pointer, as defined in RFC 6901 §6.

Link copied to clipboard
open override fun toString(): String

Returns the string representation of this pointer.