https://github.com/m1guelpf/repair-json
Repair incomplete JSON (e.g. from streaming APIs or AI models) so it can be parsed as it's received.
https://github.com/m1guelpf/repair-json
repair-json rust streaming-json
Last synced: about 1 year ago
JSON representation
Repair incomplete JSON (e.g. from streaming APIs or AI models) so it can be parsed as it's received.
- Host: GitHub
- URL: https://github.com/m1guelpf/repair-json
- Owner: m1guelpf
- License: mit
- Created: 2024-01-17T12:00:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-17T12:22:17.000Z (over 2 years ago)
- Last Synced: 2025-04-11T21:41:18.972Z (about 1 year ago)
- Topics: repair-json, rust, streaming-json
- Language: Rust
- Homepage: https://docs.rs/repair_json
- Size: 9.77 KB
- Stars: 33
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# repair_json
> Repair incomplete JSON (e.g. from streaming APIs or AI models) so it can be parsed as it's received.
[](https://crates.io/crates/repair_json)
[](https://crates.io/crates/repair_json)
[](https://docs.rs/repair_json)
## Usage
```rust
let json_stream = json_source::stream().await?;
while let Some(incomplete_json) = json_stream.next().await {
let valid_json = repair_json::repair(incomplete_json);
let parsed_struct = serde_json::from_str(valid_json).unwrap();
// ...
}
```
Refer to the [documentation on docs.rs](https://docs.rs/repair_json) for detailed usage instructions.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.