llm_json 1.0.0

A command-line tool to convert JSON files to LLM-friendly formats.
Documentation

LLM_JSON

A Rust library to repair broken JSON strings, particularly useful for handling malformed JSON output from Large Language Models.

This is a porting of the Python library json_repair, written by Stefano Baccianella and published under the MIT license.

All credits go to the original author for the amazing work.

Usage

cargo add llm_json
use llm_json::{repair_json, loads, JsonRepairError};

fn main() {
  // Basic repair
  let broken_json = r#"{name: 'John', age: 30,}"#;
  let repaired = repair_json(broken_json, &Default::default())?;
  println!("{}", repaired); // {"name": "John", "age": 30}
  
  // Parse directly to Value
  let value = loads(broken_json, &Default::default())?;
}

License

MIT