| Crates.io | json-fix |
| lib.rs | json-fix |
| version | 0.1.1 |
| created_at | 2025-06-16 12:05:10.377046+00 |
| updated_at | 2025-06-16 12:38:15.767118+00 |
| description | Robust JSON repair engine for fixing malformed or partial JSON strings, especially from AI output |
| homepage | |
| repository | https://github.com/MTraveller/json-fix |
| max_upload_size | |
| id | 1714208 |
| size | 35,454 |
json-fix is a blazing-fast, Rust-powered JSON repair library built for resilient data pipelines, GPT outputs, web scraping tools, and any system where malformed JSON sneaks in.
It detects and fixes broken JSON strings β from misescaped quotes to missing commas β using a curated sequence of regex-powered healing steps. Ideal for both CLI tools and backend services.
fancy-regexuse json_fix::fix_json_syntax;
fn main() {
let broken = r#"{ "name": "Momo, "age": 3 }"#;
let result = fix_json_syntax(broken);
if result.fixed != broken {
println!("β
Fixed JSON:\n{}", result.fixed);
} else {
println!("β οΈ No changes made.");
}
}
cargo add json-fix
let result = fix_json_syntax(broken);
cargo run --example quick_fix
Run:
cargo bench
src/lib.rs β Public-facing APIsrc/fixer.rs β Core fix logic (regex-powered)examples/quick_fix.rs β Minimal usage demotests/fixer.rs β Real-world test casebenches/fix_benchmark.rs β Criterion benchmarksMIT β In shΔΚΎ AllΔh, may it be a source of barakah for those who use and improve it.