Expand description
JSON-ish parser for handling malformed LLM outputs.
Implements a three-phase parsing strategy:
- Strip & Fix: Remove markdown, fix trailing commas, normalize quotes
- Standard Parse: Try
serde_json(fast path) - Lenient Parse: Character-by-character state machine for incomplete/malformed JSON
§Example
use simple_agents_healing::parser::JsonishParser;
let parser = JsonishParser::new();
// Parse markdown-wrapped JSON
let malformed = r#"```json
{"key": "value", "num": 42,}
```"#;
let result = parser.parse(malformed).unwrap();
assert_eq!(result.value["key"], "value");
assert_eq!(result.value["num"], 42);Structs§
- Jsonish
Parser - Three-phase JSON parser for malformed LLM outputs.
- Parser
Config - Parser configuration options.
Type Aliases§
- Parser
Result - Result of parsing with coercion tracking.