Metadata-Version: 2.4
Name: jsonquotefixer
Version: 0.2.1
Summary: Fixer for broken/unescaped quotes in pseudo-JSON text
Project-URL: Homepage, https://github.com/abzb1/jsonfixer
Project-URL: Issues, https://github.com/abzb1/jsonfixer/issues
Author-email: Hongseok Oh <cxv0519@gmail.com>
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.
License-File: LICENSE
Keywords: fix,json,pseudo-json,quotes,repair,structured output
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# 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

### Installation

`pip install jsonquotefixer`

jsonfixer automatically fixes broken quotation marks, allowing the JSON to be safely parsed with Python’s built-in json module.

### Example

```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 (\")
