HEDL JSON Conversion
Provides bidirectional conversion between HEDL documents and JSON.
Features
- Bidirectional Conversion: HEDL ↔ JSON with full fidelity
- JSONPath Queries: Extract data using standard JSONPath expressions
- JSON Schema Generation: Generate JSON Schema Draft 7 from HEDL documents
- Partial Parsing: Continue parsing despite errors and collect all errors
- Streaming Support: Memory-efficient processing of large files
- JSONL Support: Newline-delimited JSON for logs and streaming
- Zero-Copy Optimization: Reduced allocations for better performance
- Security Limits: Configurable limits to prevent DoS attacks
Modules
- [
jsonpath]: JSONPath query engine for extracting specific data - [
schema_gen]: JSON Schema generation from HEDL documents - [
streaming]: Streaming parsers for large files and JSONL format
Examples
Basic Conversion
use ;
let json = r#"{"name": "Alice", "age": 30}"#;
let doc = json_to_hedl.unwrap;
let json_out = hedl_to_json.unwrap;
JSONPath Queries
use ;
#
JSON Schema Generation
use ;
#
Streaming Large Files
use ;
use Cursor;
let jsonl = "{\"id\": \"1\"}\n{\"id\": \"2\"}";
let reader = new;
let config = default;
for result in new
Partial Parsing with Error Recovery
use ;
let json = r#"{
"valid": "data",
"users": [
{"id": "1", "name": "Alice"},
{"id": "2", "name": "Bob"}
]
}"#;
let config = builder
.tolerance
.build;
let result = partial_parse_json;
// Check if parsing completed successfully
if result.is_complete else