Path.query

json.node.Node query(string expression, json.node.Node root)

Queries a JSON tree using a JSONPath expression.

This function is a simple wrapper around json.path.Path.new_, json.path.Path.compile, and json.path.Path.match. It implicitly creates a json.path.Path instance, compiles the given expression and matches it against the JSON tree pointed by root.

Parameters

expressiona JSONPath expression
rootthe root of a JSON tree

Returns

a newly-created node of type

json.types.NodeType.Array containing the array of matching nodes

Throws