query


Description:

public static Node query (string expression, Node root) throws Error

Queries a JSON tree using a JSONPath expression.

This function is a simple wrapper around [ctor@Json.Path.new], [method@Json.Path.compile], and [method@Json.Path.match]. It implicitly creates a `JsonPath` instance, compiles the given expression and matches it against the JSON tree pointed by `root`.

Parameters:

expression

a JSONPath expression

root

the root of a JSON tree

Returns:

a newly-created node of type `JSON_NODE_ARRAY` containing the array of matching nodes