NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #560 most downloaded on PyPI
A package to repair broken json strings
Latest stable
0.64.9
Last release 6 days ago
10 Nov 2026
Ships fairly regularly
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
3 years old
189 releases · first in 2023
Drag across the ruler to compare, or tap a release to open it.
Better handling of empty key values and remove lots of dead code, plus better test coverage
Fix #62, an off by one error made it so that correct escaped sequences were not treated properly if they were at the beginning of the string.
PR #63, allow numbers to be object keys, transforming them to string first
Thanks to @andsmi97 for contributing with this PR!
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Adding ensure_ascii to the options of repair_json. By default json.dumps() sets ensure_ascii=True this is particularly a problem for chinese text that
repair_json. By default json.dumps() sets ensure_ascii=True this is particularly a problem for chinese text that has no ascii representation. Setting ensure_ascii=False will prevent chinese text from being converted into weird escaped characters in ascii and remain unicode.load function should behave like loads(). That wasn't the case so far.This release is sponsored by @t0mmili and @nhend. Thank you very much for your donation!
This library is free for everyone and it's maintained and developed as a side project so, if you find this library useful for your work, consider offering me a beer via this link: https://github.com/sponsors/mangiucugna
Fix #57, sometimes a string can look like ""string" a bug was preventing the library from fixing it like "string".
""string" a bug was preventing the library from fixing it like "string".This release is sponsored by @MorDvash. Thank you very much for your donation!
This library is free for everyone and it's maintained and developed as a side project so, if you find this library useful for your work, consider offering me a beer via this link: https://github.com/sponsors/mangiucugna
Fix #55, a fix a regression bug. Array of strings not separated by commas were not repaired.
Fix #54, fix the maximum recursion depth reached error in case the malformed json is a long long string.
maximum recursion depth reached error in case the malformed json is a long long string.This release is sponsored by @ahhardin. Thank you very much for your donation!
This library is free for everyone and it's maintained and developed as a side project so, if you find this library useful for your work, consider offering me a beer via this link: https://github.com/sponsors/mangiucugna
As additionally reported in #53, there can be cases in which not only quotes are missing but also commas are missing. That is kind of a mess, but with
Fix #53, change how missing left delimeters are handled in object context to take into account the possibility that the right side might not be missin
# Fixed - Remove garbage output
Support multiple objects in one string such as here you go {"key":"value"} and also [1,2,3] will return an array of all the valid objects found [{"key
here you go {"key":"value"} and also [1,2,3] will return an array of all the valid objects found [{"key":"value"},[1,2,3]]This release is sponsored by @AvantiB. Thank you very much for your donation!
This library is free for everyone and it's maintained and developed as a side project so, if you find this library useful for your work, consider offering me a beer via this link: https://github.com/sponsors/mangiucugna
Fix #50, if a primitive type (string, bool, number) is outside of an object or array and the json is invalid, ignore those because it's impossible to
Partially address #49, stray quotes followed by a comma are supported if it's at the end of an object
Fix #47, a stupid regression due to missing tests in the last refactor was messing up a complex json. In particular how the word "false"was managed in
Fix #46, add the support for a new edge case: in case we have non escaped quotes in an object value and a comma is present, don't automatically trunca
There was an edge case in which a stray comment inside an object that looked like a boolean would be repaired as a key
Fix #44, a better way to deal with escaping sequences in python and that is hopefully the last time I fix this.
PR #43, sometimes LLMs will be "lazy" and add an ellipsis in arrays to mean "etc.." like [1, 2, ..., 10] or [1, 2, 3, ...]. Previously the ellipsis wa
[1, 2, ..., 10] or [1, 2, 3, ...]. Previously the ellipsis was converted to string as it was not a targeted use case, now it is ignored. Thanks to @mlxyz for pushing this change.This release is sponsored by @haydenth. Thank you very much for your donation!
This library is free for everyone and it's maintained and developed as a side project so, if you find this library useful for your work, consider offering me a beer via this link: https://github.com/sponsors/mangiucugna
Fix #42, add support for currency-like numbers.
Nothing published for this version
Fix #34, sometimes llms spit weird thoughts and comments in the middle of objects, improve how we handle that.
Fix #40, in some cases a \ would send the library in an infinite loop.
Fix #39, a regression after the large refactor of the string function (done to support new use cases) introduced a bug in which the library would fail
Improve load() to avoid loading the file in memory but stream it byte by byte. This brings the method on parity with json.load() and allows large stre
load() to avoid loading the file in memory but stream it byte by byte. This brings the method on parity with json.load() and allows large stream of data to be processedFix #38, the new functions load() and from_file() were not properly exported but pointed to loads().
load() and from_file() were not properly exported but pointed to loads().Fix #37, the parser was wrongly allowing an object key to be any type but that should be only string type. This is fixed now.
string type. This is fixed now.Fix #36, a simple case of a missing comma in a simple object wasn't handled correctly, still a regression from 0.14.0.
Better handling of stray characters. Before this version, stray characters at the beginning of a valid json ( e.g. string { 'a': 'b'} ) would not be i
string { 'a': 'b'} ) would not be ignored and the json produced would be invalid.Fixed #33, the feature released in 0.14.0 had a number of unexpected side effects. This should provide a more general and stable fix.
Sorry for any inconvenience, please keep sending examples as this specific feature is really at the core of a bunch of different failure modes
A more stable and general fix to the bug fixed in 0.15.5
Fix #32, an empty object value ("") would cause a crash under certain conditions.
Fixed #29, numbers like .25 where not considered numbers. Thanks to @paulb-instacart for reporting and pushing the PR!
Fixed #27, handle fractions such as 1/3 as string "1/3". Thanks to @paulb-instacart for reporting the issue and providing a PR to fix!
Ensure that all functions passthrough optional parameters to repair_json()
Adding a logging capability to understand what has been repaired. This was a feature request that was bubbling up in the issues, probably still incomp
logging=True to repair_json() and it will return a tuple instead of just the corrected jsonFixed #26 by adding a more general way to handle special cases with html tags and markdown in which the LLM uses the wrong quotation mark. Thanks to @
Fixed #24, fixed how the library handles the change of context when objects and arrays are mixed. Before this case would cause a crash.
New function load(fd) that is a drop in replacement for json.load()
load(fd) that is a drop in replacement for json.load()from_file(string_file_path) that makes it easier to write scripts to batch process json filesFix #23, if a dangling quotation mark followed a number or a boolean it would break the json string.
Generalize the double quotation fix
Fix a corner case in case the double quotation marks aren't repeated
Fix #20, support double quotation marks as string delimiters.
Fixed a bug, removing a character needs the counter to be decreased by 1 or the parser will eat the next character. Updated Unit Tests to check for th
Fixed #19, trailing backslashes cause json.loads() to throw an exception. Removing those unless are a valid escaping sequence.
Fixed #17, the library was not dealing with escaped quotes properly. Updated code, documentation and tests to deal with that corner case
Support for slanted double quotes “ ”
PR #16. Support for "number-like" strings such as number ranges or IP addresses, those will be interpreted as string. Thanks to @tmcdonnell87 for his
Fixes #15, a nasty corner case crashed the library.
A slightly more general solution to the code markdown issue solved in 0.7.0. From now on the library won't throw an exception anymore in case of garba
Fixes #13. Sometimes json blocks are returned as markdown codeblocks, remove the backticks before processing the json.
Small changes in code led to quite significant improvements in performance, releasing this patch version for anyone that cares about performance since
Fixed a couple of corner cases that shouldn't have affected anybody but is good to have them covered. Also improved readability.
Feature request #12. Added support for broken markdown links with unquoted quotes like { "content": "[LINK]("link")" }
{ "content": "[LINK]("link")" }Fixed issue #11, an empty key in an object would cause the library to go into an infinite loop.
Feature request #10. Small LLMs (like Mistral-7B) play fast and loose with quotes in strings so you can get single quoted strings (that is not JSON st
Please note that something like 'string" will be fixed as "string\"" because otherwise the string "won't" will be broken.
Fixes in previous releases had a negative performance impact, this release optimizes the code further to go back to previous performance benchmarks
Fixed #9, a corner case caused an infinite loop.
10% faster by removing some calls to get_char_at that could have been avoided
get_char_at that could have been avoidedFixed #8, a corner case caused an infinite loop.
Now it's 20% faster! After running through the profiler I found a few ways to improve the code and the most called methods. Updated the README to give
One column per quarter.