Metadata-Version: 2.4
Name: json-comments
Version: 0.1.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Text Processing :: General
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: commentjson ; extra == 'dev'
Requires-Dist: pyjson5 ; extra == 'dev'
Requires-Dist: msgspec ; extra == 'dev'
Provides-Extra: dev
License-File: LICENSE
Summary: Rust-backed JSON comment and trailing comma stripper
Keywords: json,comments,trailing-commas,rust,performance
Author-email: Tim Hörmann <pypi@audivir.de>
Requires-Python: >=3.7, <3.14
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# json-comments

A Rust-backed JSON comment and trailing comma stripper for Python.

`json-comments` provides a single, simple utility to clean JSON-like strings before parsing them. It removes C-style (`//`), block (`/* */`), and shell-style (`#`) comments, as well as trailing commas from objects and arrays.

## Installation

```bash
pip install json-comments
```

## Usage

```python
import json
import json_comments

raw_data = """
{
    "foo": "bar", // c-style comment
    "baz": "qux", # shell-style comment
    "key": "value", /* block comment */
    "number": 123, // trailing comma
}
"""

# Strip comments and commas with `json_comments`
clean_json = json_comments.strip_json(raw_data)

# Parse with a JSON parser (e.g., `json` from the standard library)
data = json.loads(clean_json)
print(data)
# {'foo': 'bar', 'baz': 'qux', 'key': 'value', 'number': 123}
```

## Acknowledgements

This project is a Python wrapper around the [json-strip-comments](https://github.com/oxc-project/json-strip-comments) Rust crate (a fork of the original [json-comments-rs](https://github.com/tmccombs/json-comments-rs)).

Special thanks to:

- [tmccombs](https://github.com/tmccombs) for the original [json-comments-rs](https://github.com/tmccombs/json-comments-rs).
- The [oxc-project](https://github.com/oxc-project) for the [json-strip-comments](https://github.com/oxc-project/json-strip-comments) fork.

## License

MIT. See [LICENSE](LICENSE) for details including upstream copyright notices.

