Skip to main content

Class: JSONPathNodeList

jsonpath.JSONPathNodeList

Constructors

constructor

new JSONPathNodeList(nodes): JSONPathNodeList

Parameters

NameType
nodesJSONPathNode[]

Returns

JSONPathNodeList

Defined in

src/path/node.ts:51

Properties

nodes

Readonly nodes: JSONPathNode[]

Defined in

src/path/node.ts:51

Accessors

length

get length(): number

Returns

number

The number of nodes in the node list.

Defined in

src/path/node.ts:117

Methods

[iterator]

[iterator](): Iterator<JSONPathNode, any, undefined>

Returns

Iterator<JSONPathNode, any, undefined>

an iterator over nodes in the list.

Defined in

src/path/node.ts:56


empty

empty(): boolean

Returns

boolean

true if the node list is empty.

Defined in

src/path/node.ts:63


locations

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

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.

Defined in

src/path/node.ts:92


paths

paths(): string[]

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.

Defined in

src/path/node.ts:102


pointers

pointers(): JSONPointer[]

Returns

JSONPointer[]

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

Defined in

src/path/node.ts:110


values

values(): JSONValue[]

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.

Defined in

src/path/node.ts:73


valuesOrSingular

valuesOrSingular(): JSONValue

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

Returns

JSONValue

Defined in

src/path/node.ts:81