Expand description
JSONPath query engine for extracting specific data.
JSONPath query support for HEDL documents
This module provides JSONPath query functionality for HEDL documents,
allowing efficient extraction of specific data using standard JSONPath syntax.
§Features
- Standard
JSONPathSyntax: Full support forJSONPathexpressions - Efficient Queries: Optimized query execution with minimal allocations
- Type-Safe Results: Returns strongly-typed query results
- Error Handling: Comprehensive error reporting for invalid queries
§Examples
use hedl_json::jsonpath::{query, QueryConfig};
use hedl_core::Document;
fn example() -> Result<(), Box<dyn std::error::Error>> {
let doc = hedl_core::parse("name: \"Alice\"\nage: 30".as_bytes())?;
let config = QueryConfig::default();
// Simple field access
let results = query(&doc, "$.name", &config)?;
assert_eq!(results.len(), 1);
// Array filtering
let results = query(&doc, "$.users[?(@.age > 25)]", &config)?;
Ok(())
}Structs§
- Query
Config - Configuration for
JSONPathqueries - Query
Config Builder - Builder for constructing
QueryConfiginstances
Enums§
- Query
Error - Errors that can occur during
JSONPathqueries
Functions§
- query
- Query a HEDL document using
JSONPathexpression - query_
count - Count the number of matches for a
JSONPathquery - query_
exists - Check if a
JSONPathquery matches any elements in a HEDL document - query_
first - Query a HEDL document and return the first match
- query_
single - Query a HEDL document and return a single expected match
Type Aliases§
- Query
Result - Result type for
JSONPathqueries