#streaming-json #repair #incomplete #artificial-intelligence #ai-model #json

repair_json

Repair incomplete JSON (e.g. from streaming APIs) so it can be parsed as it is received.

1 unstable release

0.1.0 Jan 17, 2024

#14 in #repair

Download history 82/week @ 2025-03-11 69/week @ 2025-03-18 256/week @ 2025-03-25 485/week @ 2025-04-01 360/week @ 2025-04-08 203/week @ 2025-04-15 440/week @ 2025-04-22 270/week @ 2025-04-29 848/week @ 2025-05-06 470/week @ 2025-05-13 384/week @ 2025-05-20 141/week @ 2025-05-27 23/week @ 2025-06-03 46/week @ 2025-06-10 63/week @ 2025-06-17 89/week @ 2025-06-24

257 downloads per month
Used in 4 crates

MIT license

54KB
730 lines

repair-json

Repair incomplete JSON (e.g. from streaming APIs or AI models) so it can be parsed as it's received.

crates.io download count badge docs.rs

Usage

let json_stream = json_source::stream().await?;

while let Some(incomplete_json) = json_stream.next().await {
    let valid_json = repair_json::repair(incomplete_json);

    // serde_json::from_str(valid_json).unwrap();
}

Refer to the documentation on docs.rs for detailed usage instructions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~210–650KB
~15K SLoC