JSONPath

Query a JSON value with JSONPath (RFC 9535) — the standardized path language for selecting nodes from a document ($.store.book[?@.price < 10].title). This is the query evaluator that complements the framework's JSONPath guards (b.guardJsonPath, which screen operator-supplied path strings): query compiles a path and returns the matched values, paths returns their normalized locations.

The full RFC 9535 surface is implemented — name / wildcard / index / slice selectors, descendant segments (..), filter selectors (?) with comparison and logical operators and relative (@) / absolute ($) queries, and the five standard functions length, count, match, search, and value — with the spec's well-typedness rules enforced at compile time (a malformed or ill-typed query is rejected, not silently mis-evaluated).

b.jsonPath.query(doc, path) #

stable0.12.61soc2

Evaluate an RFC 9535 JSONPath query against a JSON value and return the array of matched node values (the nodelist, in document order). The full path language is supported — name / wildcard / index / slice selectors, descendant segments (..), and filter selectors (?) with comparisons, && / || / !, relative (@) and absolute ($) queries, and the functions length / count / match / search / value. A malformed or ill-typed query throws json-path/invalid.

b.jsonPath.query({ a: [{ p: 1 }, { p: 9 }] }, "$.a[?@.p > 5].p");
// → [9]

b.jsonPath.paths(doc, path) #

stable0.12.61

Like query, but returns the normalized-path location of each match (RFC 9535 §2.7 normalized paths, e.g. $['a'][1]['p']) instead of the values — useful for reporting or for building a follow-up patch.

b.jsonPath.paths({ a: [{ p: 1 }, { p: 9 }] }, "$.a[?@.p > 5].p");
// → ["$['a'][1]['p']"]

Last updated 2026-08-08T16:39:49.652Z by seeder.