Skip to main content

Class: JSONPathNodeList

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

Constructors

new JSONPathNodeList()

new JSONPathNodeList(nodes): JSONPathNodeList

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

Parameters

nodes

JSONPathNode[]

Returns

JSONPathNodeList

Properties

nodes

readonly nodes: JSONPathNode[]

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

Accessors

length

Get Signature

get length(): number

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

Returns

number

The number of nodes in the node list.

Methods

[iterator]()

[iterator](): Iterator<JSONPathNode>

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

Returns

Iterator<JSONPathNode>

an iterator over nodes in the list.


empty()

empty(): boolean

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

Returns

boolean

true if the node list is empty.


locations()

locations(): (string | number)[][]

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

Returns

(string | number)[][]

An array of locations for each node in the node list.

A location is an array of property names and array indices that were required to reach the node's value in the target JSON value.


paths()

paths(options?): string[]

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

Parameters

options?

SerializationOptions

Returns

string[]

An array of normalized path strings for each node in the list.

A normalized path contains only property name and index selectors, and always uses bracketed segments, never shorthand selectors.


pointers()

pointers(): JSONPointer[]

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

Returns

JSONPointer[]

An array of JSONPointer instances, one for each node in the list.


values()

values(): JSONValue[]

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

Returns

JSONValue[]

An array containing the values at each node in the list.

See

valuesOrSingular to unpack the array if there is only one node in the list.


valuesOrSingular()

valuesOrSingular(): JSONValue

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

Like values, but returns the node's value is there is only one node in the list.

Returns

JSONValue