Name | jsonquotefixer JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | Fixer for broken/unescaped quotes in pseudo-JSON text |
upload_time | 2025-08-20 07:30:53 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | The MIT License
Copyright (c) 2025 Hongseok Oh
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
fix
json
pseudo-json
quotes
repair
structured output
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Json Fixer
## Motivation
AI models often generate malformed JSON output due to incorrect handling of quotation marks.
A common issue is improperly nested double quotes, which makes the JSON invalid and unparseable with `json.loads`.
For example:
```json
{
"key1": "value1",
"key2": "value2 is behind the "value1", that is good ",
}
```
The snippet above will raise a JSONDecodeError because of the invalid quoting.
## Usage
jsonfixer automatically fixes broken quotation marks, allowing the JSON to be safely parsed with Python’s built-in json module.
Example usage:
```python
import json
from jsonfixer import fix_quotes
a = <a malformed JSON-like string to be fixed>
json.loads(a) # Raises JSONDecodeError!
b = fix_quotes(a)
json.loads(b) # Successfully parsed
```
### Arguments of fix_quotes
* **s**: a malformed JSON-like string to be fixed
* **parse_code** (bool, default=False): if True, extracts and fixes JSON from strings wrapped in triple backticks (```)
* **replace_smart** (bool, default=False): if True, replaces smart quotes (“ ”) with escaped straight quote (\")
Raw data
{
"_id": null,
"home_page": null,
"name": "jsonquotefixer",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "fix, json, pseudo-json, quotes, repair, structured output",
"author": null,
"author_email": "Hongseok Oh <cxv0519@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/45/d2/fc26b92287d4b343705a71664618784f77b483feaa27e3f52ce2af020167/jsonquotefixer-0.1.0.tar.gz",
"platform": null,
"description": "# Json Fixer\n\n## Motivation\n\nAI models often generate malformed JSON output due to incorrect handling of quotation marks. \nA common issue is improperly nested double quotes, which makes the JSON invalid and unparseable with `json.loads`. \nFor example:\n\n```json\n{\n \"key1\": \"value1\",\n \"key2\": \"value2 is behind the \"value1\", that is good \",\n}\n```\n\nThe snippet above will raise a JSONDecodeError because of the invalid quoting.\n\n## Usage\n\njsonfixer automatically fixes broken quotation marks, allowing the JSON to be safely parsed with Python\u2019s built-in json module.\n\nExample usage:\n```python\nimport json\nfrom jsonfixer import fix_quotes\n\na = <a malformed JSON-like string to be fixed>\njson.loads(a) # Raises JSONDecodeError!\n\nb = fix_quotes(a)\njson.loads(b) # Successfully parsed\n```\n### Arguments of fix_quotes\n\n* **s**: a malformed JSON-like string to be fixed\n* **parse_code** (bool, default=False): if True, extracts and fixes JSON from strings wrapped in triple backticks (```)\n* **replace_smart** (bool, default=False): if True, replaces smart quotes (\u201c \u201d) with escaped straight quote (\\\")",
"bugtrack_url": null,
"license": "The MIT License\n \n Copyright (c) 2025 Hongseok Oh\n \n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Fixer for broken/unescaped quotes in pseudo-JSON text",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/abzb1/jsonfixer",
"Issues": "https://github.com/abzb1/jsonfixer/issues"
},
"split_keywords": [
"fix",
" json",
" pseudo-json",
" quotes",
" repair",
" structured output"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "cc37319492b61704932e08e95008adbbda5fa58edfbe21682fc953c0aa411b4c",
"md5": "88767a2497211818152c33dd8975dcd1",
"sha256": "ee833be6d9e5199efd64d64033186e3e01188989cd5869f30874e7b20131ea4a"
},
"downloads": -1,
"filename": "jsonquotefixer-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "88767a2497211818152c33dd8975dcd1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4647,
"upload_time": "2025-08-20T07:30:52",
"upload_time_iso_8601": "2025-08-20T07:30:52.233992Z",
"url": "https://files.pythonhosted.org/packages/cc/37/319492b61704932e08e95008adbbda5fa58edfbe21682fc953c0aa411b4c/jsonquotefixer-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "45d2fc26b92287d4b343705a71664618784f77b483feaa27e3f52ce2af020167",
"md5": "f884e33bde6f84017a01bf581c660637",
"sha256": "50b5bfdd67ef4451740707dd2d90038924397fab2f69348e3112f4ebe615e0bb"
},
"downloads": -1,
"filename": "jsonquotefixer-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "f884e33bde6f84017a01bf581c660637",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3491,
"upload_time": "2025-08-20T07:30:53",
"upload_time_iso_8601": "2025-08-20T07:30:53.576151Z",
"url": "https://files.pythonhosted.org/packages/45/d2/fc26b92287d4b343705a71664618784f77b483feaa27e3f52ce2af020167/jsonquotefixer-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-20 07:30:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "abzb1",
"github_project": "jsonfixer",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jsonquotefixer"
}