jsonpath-rs

Crates.io docs.rs Rust CI

A Rust JsonPath implementation based on the Java json-path/JsonPath project.

Usage

```rust use jsonpath::JsonPathQuery; use serdejson::json;

let object = json!({"greetings": "hello, jsonpath"}); let result = object.query("$.['greetings']"); asserteq!(Ok(json!("hello, json_path")), result); ```

Features

Operators

| Operator | Description | | :------------------------ | :------------------------------------------------------------------- | | $ | The root element to query. This starts all path expressions. | | @ | WIP, The current node being processed by a filter predicate. | | * | Wildcard. Available anywhere a name or numeric are required. | | .. | Deep scan. Available anywhere a name is required. | | .<name> | Dot-notated child | | ['<name>' (, '<name>')] | Bracket-notated child or children | | [<number> (, <number>)] | Array index or indexes | | [start:end] | Array slice operator | | [?(<expression>)] | WIP, Filter expression. Expression must evaluate to a boolean value. |

  1. Can use negative numbers for both array index or array slice. It indicates the evaluator to access an item from the end of the array.
  2. Array slice can support notions like:

Similar Projects