serde_json_path

RFC 9535 JSONPath queries for serde_json Value trees in Rust.

Library
Cargo
v0.7.2
70stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
51/100Fair
Development Activity52
Maintenance44
Community36
Maturity52
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
71/100Good
Architecture75
Code Quality80
Innovation62
Learning Curve68

serde_json_path lets Rust programs query serde_json::Value data using JSONPath, the RFC 9535 standard query language for JSON. It parses JSONPath expressions and evaluates them against JSON trees, returning matched nodes for extraction, filtering, or existence checks.

What You Get

  • A JsonPath type parsed once from a JSONPath string and reused across queries
  • Full RFC 9535 filter-expression support (comparisons, logical operators, function extensions)
  • Optional regex feature enabling regex-based filter functions
  • Validation against the official JSONPath Compliance Test Suite as a git submodule

Common Use Cases

  • Extracting specific fields from deeply nested or variably-shaped JSON API responses
  • Filtering arrays of JSON objects by field values without writing manual recursive matching code
  • Validating that a JSON document contains expected paths in tests or data pipelines
  • Implementing configuration or template systems that reference JSON data by JSONPath expression

Under The Hood

Architecture - The workspace splits parsing/AST types into serde_json_path_core, procedural macros (for compile-time-checked embedded JSONPath literals) into serde_json_path_macros, and the main serde_json_path crate wires a nom-based recursive-descent parser to an evaluator that walks serde_json::Value trees node-by-node, applying selectors (name, index, slice, wildcard, filter) at each step. Tech Stack - Rust 2021 edition, built on nom for parsing, serde/serde_json for the JSON value model, thiserror for error types, inventory for the function-extension registry, with optional regex and tracing features gated behind Cargo feature flags. Code Quality - Tested extensively: tests/compliance.rs runs the official RFC 9535 JSONPath Compliance Test Suite (vendored as a git submodule and run via a dedicated CI workflow), alongside serde.rs, functions.rs, spec_examples.rs, and regressions.rs for serde integration, function extensions, spec examples, and regression coverage respectively. API Design - The API centers on a single JsonPath::parse entry point returning a reusable query object with .query()/.query_located() methods, plus a json_path! macro for compile-time-validated literals — a small, consistent surface that maps closely to how JSONPath itself is used.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search