Packages / rupm

json-path-tools 0.1.0

A JSONPath subset for serde_json values: child names, indexes, slices, wildcards and recursive descent

Install

cargo add json-path-tools --registry rupm

In Ruststudio: Packages, search for json-path-tools, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.

Versions

README

# json-path-tools

A JSONPath subset for serde_json values: child names, indexes, slices, wildcards and recursive descent

Add it with `rupm add json-path-tools` (or `cargo add json-path-tools --registry rupm`).

```rust
use json_path_tools::{select, JsonPath};
use serde_json::json;

let doc = json!({"store": {"book": [{"title": "A", "price": 8}, {"title": "B", "price": 12}]}});

let titles = select(&doc, "$.store.book[*].title").unwrap();
assert_eq!(titles, vec![&json!("A"), &json!("B")]);

let last = select(&doc, "$.store.book[-1].price").unwrap();
assert_eq!(last, vec![&json!(12)]);

let all_prices = JsonPath::parse("$..price").unwrap().query(&doc);
assert_eq!(all_prices.len(), 2);
```