Skip to main content

Function: resolve()

resolve(pointer, value, fallback): JSONValue

Defined in: src/pointer/index.ts:34

Resolve JSON Pointer pointer against JSON-like data value.

Parameters

pointer

string

A string representation of a JSON pointer.

value

JSONValue

The target JSON-like value, possibly loaded using JSON.parse().

fallback

MaybeJSONValue = UNDEFINED

A default value to return if value has no path matching pointer.

Returns

JSONValue

The value identified by pointer or, if given, the fallback value in the even of a JSONPointerResolutionError.

Throws

JSONPointerResolutionError If the value pointed to by pointer does not exist in value, and no fallback value is given.

Throws

JSONPointerSyntaxError If pointer is malformed according to RFC 6901.