Skip to main content

Class: JSONPathQuery

Defined in: src/path/path.ts:11

A compiled JSONPath query ready to be applied to different data repeatedly.

Constructors​

new JSONPathQuery()​

new JSONPathQuery(environment, segments): JSONPathQuery

Defined in: src/path/path.ts:12

Parameters​

environment​

JSONPathEnvironment

segments​

JSONPathSegment[]

Returns​

JSONPathQuery

Properties​

environment​

readonly environment: JSONPathEnvironment

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


segments​

readonly segments: JSONPathSegment[]

Defined in: src/path/path.ts:14

Methods​

lazyQuery()​

lazyQuery(value): IterableIterator<JSONPathNode>

Defined in: src/path/path.ts:35

Apply this JSONPath query to value.

Parameters​

value​

JSONValue

A JSON-like object to apply this query to.

Returns​

IterableIterator<JSONPathNode>

An iterator over nodes matched by applying this query to value.


match()​

match(value): undefined | JSONPathNode

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

Return a JSONPathNode instance for the first object found in value matching this query.

Parameters​

value​

JSONValue

JSON-like data to which this query will be applied.

Returns​

undefined | JSONPathNode

The first node in value matching this query, or undefined if there are no matches.


query()​

query(value): JSONPathNodeList

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

Apply this JSONPath query to value.

Parameters​

value​

JSONValue

A JSON-like object to apply this query to.

Returns​

JSONPathNodeList

Nodes matched by applying this query to value.


singularQuery()​

singularQuery(): boolean

Defined in: src/path/path.ts:70

Return true if this query is a singular query, or false otherwise.

Returns​

boolean


toString()​

toString(options?): string

Defined in: src/path/path.ts:63

Return a string representation of this query.

Parameters​

options?​

SerializationOptions

Returns​

string