Skip to main content

Class: JSONPathNode

Defined in: src/path/node.ts:13

The pair of a JSON value and its location found in the target JSON value.

Constructors​

new JSONPathNode()​

new JSONPathNode(value, location, root): JSONPathNode

Defined in: src/path/node.ts:19

Parameters​

value​

JSONValue

The JSON value found at location.

location​

(string | number)[]

The parts of a normalized path to value.

root​

JSONValue

The target value at the top of the JSON node tree.

Returns​

JSONPathNode

Properties​

location​

readonly location: (string | number)[]

Defined in: src/path/node.ts:21

The parts of a normalized path to value.


root​

readonly root: JSONValue

Defined in: src/path/node.ts:22

The target value at the top of the JSON node tree.


value​

readonly value: JSONValue

Defined in: src/path/node.ts:20

The JSON value found at location.

Accessors​

path​

Get Signature​

get path(): string

Defined in: src/path/node.ts:28

Deprecated​

Use getPath with options.form set to canonical instead.

Returns​

string

Methods​

getPath()​

getPath(options?): string

Defined in: src/path/node.ts:39

Get the path to this node in the target JSON value.

Given that the path refers to the singular current node, the returned path will always be a normalized path if options.form is set to canonical, following section 2.7 of RFC 9535.

Parameters​

options?​

SerializationOptions

Returns​

string


toPointer()​

toPointer(): JSONPointer

Defined in: src/path/node.ts:53

Return this node's location as a JSONPointer.

Returns​

JSONPointer