Expand description
JSONPath evaluation — RFC 9535 via serde_json_path
Replaces the minimal custom util/jsonpath.rs with RFC 9535 compliance.
Supports:
- Dot notation:
$.a.b.c - Array index:
$.a[0].b - Wildcards:
$[*],$.items[*].name - Filters:
$.items[?@.price > 100] - Recursive descent:
$..email - Slices:
$.items[0:5]
§Usage
ⓘ
use nika::binding::jsonpath;
let value = json!({"items": [{"name": "a"}, {"name": "b"}]});
// Simple path (fast, no RFC parse overhead)
let result = jsonpath::resolve(&value, "items[0].name")?;
assert_eq!(result, Some(json!("a")));
// Rich JSONPath query (RFC 9535)
let result = jsonpath::query(&value, "$.items[*].name")?;
assert_eq!(result, json!(["a", "b"]));Enums§
- Segment
- A parsed path segment (field or array index)
Functions§
- apply
- Apply parsed segments to a JSON value.
- is_
jsonpath - Check if a path uses rich JSONPath features (wildcards, filters, slices, recursive descent).
- parse
- Parse a simple JSONPath string into segments.
- query
- Evaluate a RFC 9535 JSONPath expression against a JSON value.
- resolve
- Parse and apply a simple path in one step.
- try_
parse_ json_ str - Try to parse a JSON string Value into a structured Value.
- validate
- Validate simple JSONPath syntax without evaluating.