Class: JSONPathEnvironment
Defined in: src/path/environment.ts:60
Constructors
Constructor
new JSONPathEnvironment(
options?):JSONPathEnvironment
Defined in: src/path/environment.ts:102
Parameters
options?
JSONPathEnvironmentOptions = {}
Environment configuration options.
Returns
JSONPathEnvironment
Properties
functions
functions:
object
Defined in: src/path/environment.ts:97
Index Signature
[key: string]: FilterFunction
maxExpressionDepth
readonlymaxExpressionDepth:number
Defined in: src/path/environment.ts:87
The maximum number of nested expressions allowed in a query before a
JSONPathRecursionError is thrown.
maxIntIndex
readonlymaxIntIndex:number
Defined in: src/path/environment.ts:75
The maximum integer allowed when indexing or slicing an array. Defaults to 2**53 -1.
maxRecursionDepth
readonlymaxRecursionDepth:number
Defined in: src/path/environment.ts:93
The maximum number of objects and/or arrays the descendant segment can
visit before a JSONPathRecursionError is thrown.
minIntIndex
readonlyminIntIndex:number
Defined in: src/path/environment.ts:81
The minimum integer allowed when indexing or slicing an array. Defaults to -(2**53) -1.
parser
readonlyparser:ParserClass
Defined in: src/path/environment.ts:95
strict
readonlystrict:boolean
Defined in: src/path/environment.ts:69
Indicates if the environment should to be strict about its compliance with JSONPath standards.
Defaults to true. Setting strict to false enables the non-standard
current key identifier, key selector, keys selector and keys filter
selector.
Methods
compile()
compile(
expression):JSONPathQuery
Defined in: src/path/environment.ts:116
Compile a JSONPath query expression for later evaluation.
Parameters
expression
string
Returns
find()
find(
expression,data):JSONPathNode[]
Defined in: src/path/environment.ts:123
Evaluate JSONPath query expression against data and return an array of matched nodes.
Parameters
expression
string
data
Returns
findAll()
findAll(
expression,data):JSONValue[]
Defined in: src/path/environment.ts:158
Evaluate JSONPath query expression against data and return an array of values.
Parameters
expression
string
data
Returns
findAllIter()
findAllIter(
expression,data):IterableIterator<JSONValue>
Defined in: src/path/environment.ts:168
Evaluate JSONPath query expression against data and generate values lazily.
Note that some queries will require internal iterators to be materialized into arrays, so peak memory usage might be higher than expected.
Parameters
expression
string
data
Returns
IterableIterator<JSONValue>
findIter()
findIter(
expression,data):IterableIterator<JSONPathNode>
Defined in: src/path/environment.ts:133
Evaluate JSONPath query expression against data and generate nodes lazily.
Note that some queries will require node iterators to be materialized into node lists, so peak memory usage might be higher than expected.
Parameters
expression
string
data
Returns
IterableIterator<JSONPathNode>
findOne()
findOne(
expression,data):JSONPathNode|undefined
Defined in: src/path/environment.ts:176
Evaluate JSONPath query expression against data and return the first matching node,
or undefined if there were no matches.
Parameters
expression
string
data
Returns
JSONPathNode | undefined
lazyQuery()
lazyQuery(
expression,data):IterableIterator<JSONPathNode>
Defined in: src/path/environment.ts:151
Evaluate JSONPath query expression against data and generate nodes lazily.
Parameters
expression
string
data
Returns
IterableIterator<JSONPathNode>
Deprecated
Use findIter instead.
match()
match(
expression,data):JSONPathNode|undefined
Defined in: src/path/environment.ts:186
Evaluate JSONPath query expression against data and return the first matching node,
or undefined if there were no matches.
Parameters
expression
string
data
Returns
JSONPathNode | undefined
Deprecated
Use findOne instead.
query()
query(
expression,data):JSONPathNode[]
Defined in: src/path/environment.ts:142
Evaluate JSONPath query expression against data and return an array of matched nodes.
Parameters
expression
string
data
Returns
Deprecated
Use find instead.
setupFilterFunctions()
protectedsetupFilterFunctions():void
Defined in: src/path/environment.ts:202
A hook for setting up the function register. You are encouraged to
override this method in classes extending JSONPathEnvironment.
Returns
void
test()
test(
expression,data):boolean
Defined in: src/path/environment.ts:194
Return true if JSONPath query expression matches at least one node in data, or
false otherwise.
Parameters
expression
string
data
Returns
boolean