4 releases (2 breaking)

0.3.1 Mar 28, 2024
0.3.0 Feb 29, 2024
0.2.0 Jan 15, 2024
0.1.0 Jan 10, 2024

#1452 in Parser implementations

Download history 1/week @ 2024-09-03 2/week @ 2024-09-10 1/week @ 2024-09-17 6/week @ 2024-09-24 5/week @ 2024-10-01 2/week @ 2024-10-15 51/week @ 2024-10-22 42/week @ 2024-10-29 27/week @ 2024-11-05 12/week @ 2024-11-12 10/week @ 2024-11-19

100 downloads per month
Used in 2 crates

MIT license

230KB
4.5K SLoC

rsonpath-syntax – JSONPath parser

Rust docs.rs

Crates.io

MSRV License

Complete, fast, and fully spec-compliant JSONPath query parser.

Usage

Parse a query to its AST with the parse function.

let query = rsonpath_syntax::parse("$.jsonpath[*]")?;

For advanced usage consult the crate documentation.

Feature flags

There are two optional features:

  • arbitrary, which enables a dependency on the arbitrary crate to provide Arbitrary implementations on query types; this is used e.g. for fuzzing.
  • color, which enables a dependency on the owo_colors crate to provide colorful Display representations of ParseError with the colored function.

Examples

There are two examples programs, builder showcases usage of the JsonPathQueryBuilder struct; cli is a small CLI tool that takes one argument, a query to parse, and prints a debug representation of the result query, or an error message – this is useful for debugging when developing the crate itself.

State of the crate

This is an in-development version that supports only name, index, and wildcard selectors. However, these are fully supported, tested, and fuzzed. The planned roadmap is:

  • support slices
  • support filters (without functions)
  • support functions (including type check)
  • polish the API
  • 1.0.0 stable release

Dependencies

~2.1–3MB
~55K SLoC