rsonpath-syntax – JSONPath parser
Complete, fast, and fully spec-compliant JSONPath query parser.
Usage
Parse a query to its AST with the parse function.
let query = parse?;
For advanced usage consult the crate documentation.
Feature flags
There are three optional features:
arbitrary, which enables a dependency on thearbitrarycrate to provideArbitraryimplementations on query types; this is used e.g. for fuzzing.color, which enables a dependency on theowo_colorscrate to provide colorfulDisplayrepresentations ofParseErrorwith thecoloredfunction.serde, which enables a dependency on theserdecrate to provide serialization and deserialization ofJsonPathQueryand all the underlying types.
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
Showing direct dependencies.
rsonpath-syntax v0.4.0 (/home/mat/src/rsonpath/crates/rsonpath-syntax)
├── arbitrary v1.4.1
├── nom v7.1.3
├── owo-colors v4.1.0
├── serde v1.0.217
├── thiserror v2.0.9
└── unicode-width v0.2.0
Justification
arbitrary– optionalArbitrarysupport for fuzzing.nom– combinator-based parsing used throughout the crate.owo-colors– optional feature for pretty error messages.serde– optional dependency for serialization and deserialization of compiled engines.thiserror– idiomaticErrorimplementations.unicode-width– used to display error messages correctly in presence of wider Unicode characters in the query string.