Metadata-Version: 2.3
Name: jsonc2json
Version: 0.0.4
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: 3
Summary: jsonc2json ~ convert jsonc 2 json ~ python + rust
Keywords: json,jsonc,rust,pyo3
Author-email: Jesse Rubin <jessekrubin@gmail.com>
Maintainer-email: Jesse Rubin <jessekrubin@gmail.com>
License: MIT OR Apache-2.0
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: documentation, https://github.com/jessekrubin/jsonc2json
Project-URL: homepage, https://github.com/jessekrubin/jsonc2json
Project-URL: source, https://github.com/jessekrubin/jsonc2json

# jsonc2json

python & rust package to strip comments from jsonc strings/bytes

uses: https://docs.rs/json_comments/latest/json_comments/

## Install:

```bash
pip install jsonc2json
```

## Usage:

```python
from jsonc2json import jsonc2json

jsonc_string = """
{
    "name": /* full */ "John Doe",
    "age": 43,
    "phones": [
        "+44 1234567", // work phone
        "+44 2345678"  // home phone
    ]  # hash comment
}
""".strip()

json_string = jsonc2json(jsonc_string)

print(json_string)
# PRINTS:
# {
#     "name":            "John Doe",
#     "age": 43,
#     "phones": [
#         "+44 1234567",
#         "+44 2345678"
#     ]
# }

assert isinstance(json_string, str)
assert isinstance(jsonc2json(jsonc_string.encode()), bytes)
```

## CLI

```bash
# stdin
$ echo '{"a": 1 /* comment */, "b": 2}' | python -m jsonc2json
'{"a": 1              , "b": 2}'
# file (still stdin!)
$ python -m jsonc2json < has-comments.jsonc > no-comments.json
```


## TODO:

- [ ] Add options present in the rust package
- [ ] Clap CLI?
- [ ] build confit

