| Crates.io | chill-json |
| lib.rs | chill-json |
| version | 0.1.2 |
| created_at | 2025-07-21 15:55:08.040212+00 |
| updated_at | 2025-08-12 11:53:45.696291+00 |
| description | At times JSON is enclosed in surrounding text and often created by tools like LLMs or humans with no strict adherence to formatting. JSON is often not complete or incorrect or commas are missing or braces are there. The rule bound JSON parsers are not helpful in extracting `whatever is possible` from the given input. This lib extract whatever is possible in failsafe manner. It fails only when there are multiple independent JSON structures in the input. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1762209 |
| size | 93,642 |
Extracting JSON from real-world text can be challenging—especially when data is loosely formatted by humans or generated by large language models. Standard JSON parsers often fail or discard useful content when data is incomplete, contains extraneous text, or has minor formatting errors.
This library is designed to robustly extract JSON data from messy input. Whether the JSON snippet is embedded in surrounding text, has missing commas or braces, or contains other common human or machine errors, this tool strives to recover as much usable data as possible. It provides:
Resilient Extraction: Parses and extracts whatever JSON it can from noisy or partially malformed input.
Minimal Failures: It only fails when the input contains multiple independent JSON structures, making it highly tolerant in most real-world scenarios.
Failsafe Design: Built to maximize data recovery without being tripped up by small mistakes or unexpected formatting.
Recovering JSON generated by LLMs or manual inputs with imperfect structure.
Parsing logs, transcripts, or text streams where valid JSON objects are surrounded by arbitrary text.
Extracting data from sources where strict JSON compliance cannot be guaranteed.
If traditional JSON parsers stop at the first mistake, this library aims to "make the best of what you have"—enabling you to keep moving forward with whatever data can be extracted. Perfect for developers and data wranglers who value resilience and flexibility in their text processing pipelines.
running 21 tests
test fuzzy_json_tests::test_builder_pattern ... ok
test fuzzy_json_tests::test_basic_parsing ... ok
test fuzzy_json_tests::test_code_block_markers ... ok
test fuzzy_json_tests::test_single_quotes ... ok
test fuzzy_json_tests::test_trailing_comma ... ok
test fuzzy_json_tests::test_mixed_quotes ... ok
test fuzzy_json_tests::test_truncated_after_colon ... ok
test fuzzy_json_tests::test_truncated_array ... ok
test fuzzy_json_tests::test_truncated_object ... ok
test fuzzy_json_tests::test_truncated_array_with_trailing_comma ... ok
test fuzzy_json_tests::test_mixed_truncation_scenarios ... ok
test fuzzy_json_tests::test_truncated_incomplete_property ... ok
test fuzzy_json_tests::test_truncated_string ... ok
test fuzzy_json_tests::test_truncated_with_complete_str_value_at_end ... ok
test fuzzy_json_tests::test_truncated_with_incomplete_str_value_at_end ... ok
test fuzzy_json_tests::test_truncated_with_incomplete_number_property_at_end ... ok
test fuzzy_json_tests::test_truncated_with_code_blocks ... ok
test fuzzy_json_tests::test_truncated_nested ... ok
test fuzzy_json_tests::test_json_locked_in_json_code_formating ... ok
test fuzzy_json_tests::test_json_having_arbitrary_text_in_beginning ... ok
test fuzzy_json_tests::test_json_having_arbitrary_text_at_the_end ... ok
test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s