Documentation
¶
Overview ¶
Package jsonpath implements JSONPath (RFC 9535): parsing a query with Parse and evaluating it against a decoded JSON document with Eval.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ParseError ¶
ParseError reports a query that does not match the JSONPath grammar (RFC 9535). Pos is a rune offset into the query string.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is a parsed JSONPath query, ready to be evaluated with Eval.
func Parse ¶
Parse parses a JSONPath query (RFC 9535). The query must start with the root identifier "$" and consume the whole input.
func (*Query) Eval ¶
Eval evaluates the query against root, returning the selected nodes in document order: for a descendant segment, a node is visited before its children (pre-order); object members are visited in the order they are stored (DecodeJSON stores them sorted by key, so a query over decoded JSON always sees a deterministic order).