pub fn evaluate_path(
node: &JsonNode,
path: &str,
) -> Result<Vec<JsonNode>, String>Expand description
Evaluates a JSONPath expression against the parsed document AST, returning
all matching nodes as a list of JsonNode values.
The expression is first parsed and validated by serde_json_path. If it is
syntactically invalid, an Err is returned before any document traversal
occurs. Matching is performed on a serde_json::Value projection of the
document; each matched value is then converted back to a JsonNode for a
consistent return type. Returned nodes carry a zeroed Span (0..0)
because byte offset information is not recoverable through the
serde_json::Value round-trip.
§Arguments
node- A reference to the rootJsonNodeof the document to query against.path- The RFC 9535 JSONPath expression string to evaluate (e.g.$.store.book[*].author).
§Returns
Ok(Vec<JsonNode>)- Zero or more nodes matched by the expression, in document order. An emptyVecindicates the expression is valid but matched nothing.Err(String)- A human-readable description of the parse error if the expression is syntactically invalid.