Expand description
§json-streamparse-rs
Streaming JSON balance detector. Feed bytes incrementally and ask whether the buffer currently holds a complete top-level JSON value.
This is not a full parser; it’s the small utility you want when an
LLM is producing JSON token-by-token and you need to know “can I
hand this to serde_json::from_str yet?” without actually parsing
every prefix.
String-aware (won’t be fooled by { inside a string literal),
escape-aware (\\\" doesn’t end the string).
§Example
use json_streamparse_rs::Balancer;
let mut b = Balancer::new();
b.push(b"{\"name\":\"Cl");
assert!(!b.complete());
b.push(b"aude\",\"v\":1}");
assert!(b.complete());Structs§
- Balancer
- Streaming JSON balance detector.