Skip to main content

Module path

Module path 

Expand description

JSONPath parsing and typed construction.

Rama targets RFC 9535 JSONPath. This module implements the selectors that can be matched efficiently from the concrete path of a value observed by a forward streaming parser.

§RFC 9535 support matrix

FeatureStatusNotes
Root selector $supportedAlways the implicit path root.
Dot member .namesupportedRFC identifier shorthand.
Bracket member ['name'] / ["name"]supportedJSON string escapes, including surrogate pairs.
Wildcard *supportedChild and descendant forms.
Array index [0]supportedNon-negative indexes.
Array slice [start:end:step]supportedNon-negative bounds and non-negative step. A zero step matches no elements.
Selector lists / unions [0,'name',*]supportedChild and descendant forms.
Descendant segment ..supportedMember, index, wildcard, slice, and union selectors.
Negative indexes / slicesunsupportedRFC semantics require array length, which a pure forward matcher does not know.
Filter selectors [?(...)]unsupportedRequires an expression evaluator and possibly buffered subtrees.

§Example

use rama_json::path::JsonPath;

let path = JsonPath::builder()
    .member("store")
    .member("book")
    .wildcard()
    .member("author")
    .build();

assert_eq!(path.to_string(), "$.store.book[*].author");

Structs§

JsonPath
A compiled JSONPath expression.
JsonPathBuilder
Typed builder for JsonPath.
Slice
RFC 9535 array slice selector with streaming-compatible semantics.

Enums§

PathElement
One concrete location segment for a value encountered in a JSON document.
Segment
One JSONPath selector segment after the root.