π οΈ json-fix
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.
π Features
- β Fixes unescaped or invalid quote issues
- β Repairs trailing commas, missing brackets, and embedded key-value bugs
- β
Pure Rust β no unsafe, no dependencies outside
fancy-regex
- β Supports logs for each fix step
- β Battle-tested against AI-generated JSON errors
- β Easily embeddable as a library or CLI tool
π§ͺ Example
use fix_json_syntax;
π Usage
Install:
As a library:
let result = fix_json_syntax;
From CLI:
π Benchmarks
Run:
π Project Structure
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 benchmarks
βοΈ License
MIT β In shΔΚΎ AllΔh, may it be a source of barakah for those who use and improve it.