Expand description
§fionn-gron - SIMD-accelerated gron implementation
This module provides a high-performance implementation of the gron transformation, which converts JSON into greppable, line-oriented output format.
§Features
- SIMD-accelerated parsing: Uses fionn’s tape for efficient JSON parsing
- Efficient path building: Stack-based incremental path construction
- Extended path syntax: Supports bracket notation for special field names
- Ungron support: Reconstruct JSON from gron output
- JSONL support: Process newline-delimited JSON files
- Query mode: Filter output with JSONPath-like queries
§Example
ⓘ
use fionn::gron::{gron, GronOptions};
let json = r#"{"name": "Alice", "age": 30}"#;
let output = gron(json, &GronOptions::default())?;
// Output:
// json = {};
// json.name = "Alice";
// json.age = 30;§JSONL Processing
ⓘ
use fionn::gron::{gron_jsonl, GronJsonlOptions};
let jsonl = b"{\"a\":1}\n{\"b\":2}";
let output = gron_jsonl(jsonl, &GronJsonlOptions::default())?;
// json[0].a = 1;
// json[1].b = 2;§Query Mode
ⓘ
use fionn::gron::{gron_query, Query, GronOptions};
let json = r#"{"users": [{"name": "Alice"}, {"name": "Bob"}]}"#;
let query = Query::parse(".users[*].name")?;
let output = gron_query(json, &query, &GronOptions::default())?;
// json.users[0].name = "Alice";
// json.users[1].name = "Bob";Structs§
- Gron
Jsonl Options - Options for JSONL processing.
- Gron
Line - A single gron output line with zero-copy semantics where possible.
- Gron
Options - Options for gron output.
- Gron
Output Zc - Zero-copy gron output as a vector of lines.
- Gron
Parallel Options - Options for parallel gron output.
- Gron
Query Options - Options for query-filtered gron.
- Jsonl
Stats - Processing statistics for JSONL.
- Parsed
Extended Path - Parsed extended path with owned storage.
- Path
Builder - Stack-based path builder for efficient path construction.
- Query
- A compiled query for path matching.
Enums§
- Error
Mode - Error handling for malformed lines.
- Extended
Path Component - Extended path component supporting both field access and array indexing.
- Gron
Output - Output format for gron.
- Index
Format - How to format the line index in output.
- Match
Potential - Result of checking match potential.
- Query
Error - Query parsing error.
- Query
Segment - A segment in a query path.
- Unescape
Error - Error type for unescape operations.
Functions§
- escape_
json_ string - Escape a string for JSON output.
- escape_
json_ string_ simd - SIMD-accelerated JSON string escaping.
- escape_
json_ to_ string - Escape a JSON string, returning a new String.
- gron
- Convert JSON to gron format.
- gron_
jsonl - Process JSONL data with SIMD-accelerated line detection.
- gron_
jsonl_ streaming - Process JSONL from a buffered reader (streaming mode).
- gron_
jsonl_ to_ writer - Process JSONL data, writing to a writer.
- gron_
parallel - Convert JSON to gron format using parallel processing for large arrays.
- gron_
query - Query-filtered gron output.
- gron_
query_ to_ writer - Query-filtered gron output to a writer.
- gron_
to_ writer - Convert JSON to gron format, writing to a writer.
- gron_
zerocopy - Convert JSON to zero-copy gron output.
- needs_
escape - Check if a string needs JSON escaping.
- needs_
quoting - Check if a field name needs bracket notation (quoting).
- parse_
extended_ path - Parse an extended path into owned components.
- parse_
extended_ path_ ref - Parse an extended path into borrowed components.
- unescape_
json_ string_ simd - SIMD-accelerated JSON string unescaping.
- unescape_
json_ to_ string - Unescape a JSON string, returning a new String.
- ungron
- Convert gron output back to JSON string.
- ungron_
to_ value - Convert gron output to a
serde_jsonValue.