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
Download history 1273/week @ 2024-06-21 1098/week @ 2024-06-28 1570/week @ 2024-07-05 1437/week @ 2024-07-12 904/week @ 2024-07-19 518/week @ 2024-07-26 252/week @ 2024-08-02 66/week @ 2024-08-09 72/week @ 2024-08-16 39/week @ 2024-08-23 28/week @ 2024-08-30 206/week @ 2024-09-06 23/week @ 2024-09-13 31/week @ 2024-09-20 24/week @ 2024-09-27 9/week @ 2024-10-04

91 downloads per month
Used in 2 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

~265–720KB
~17K SLoC