Metadata-Version: 2.4
Name: pyjsony
Version: 0.1.17
Summary: JSON superset with relaxed syntax and runtime patching
Project-URL: Homepage, https://gitlab.com/viraven/pyjsony
Author-email: Ivan Chetchasov <vi.is.chapmann@gmail.com>
License: BSD2
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Description-Content-Type: text/markdown

# JSONY

JSONY is a **JSON superset and runtime compatibility layer** that extends JSON syntax while remaining fully usable as a drop-in replacement via standard library patching.

It is designed for **gradual migration of large Python codebases** and **configuration-heavy systems**.

---

## Why JSONY

JSON is strict, verbose, and unfriendly to human editing.

JSONY introduces a relaxed syntax while preserving compatibility with Python’s `json` module via optional runtime patching.

---

## Features

- Optional quotes for keys and string values
- Line (`//`) and block (`/* */`) comments
- Trailing commas in objects and arrays
- Bare identifiers (`foo`, `bar`, `null`, `true`, `false`)
- UTF-8 strict parsing
- Drop-in replacement for Python `json` via `jsonx.patch()`
- Deterministic parsing behavior

---

## Quick start

### 1. Patch standard JSON module

```python
import pyjsony

pyjsony.patch()

import json

data = json.loads("""
a: 1,
b: 2,
c: {
    nested: value
}
""")

print(data)
```

---

### 2. Direct usage (no patching)

```python
from pyjsony import loads

data = loads("""
obj: {
    foo: bar,
    list: [1, 2, 3]
}
""")
```

---

## Syntax example

```jsony
// JSONY allows relaxed, human-friendly syntax

config:
{
    host: localhost,
    port: 8080,

    features: [
        logging,
        metrics,
        tracing,
    ]
}
```

---

## Comparison with JSON

| Feature           | JSON | JSONY |
| ----------------- | ---- | ----- |
| Unquoted keys     | ❌   | ✅    |
| Comments          | ❌   | ✅    |
| Trailing commas   | ❌   | ✅    |
| Bare identifiers  | ❌   | ✅    |
| Patch integration | ❌   | ✅    |

---

## Installation

### pip

```bash
pip install pyjsony
```

### uv

```bash
uv add pyjsony
```

or

```bash
uv pip install pyjsony
```

---

## Design goals

* Backwards-compatible superset of JSON syntax
* Seamless migration path for large Python codebases
* Minimal cognitive overhead for configuration files
* Runtime opt-in compatibility via `patch()`

---

## Warning

> ⚠️ `jsony.patch()` mutates the global Python `json` module.

This affects all code in the current runtime process, including dependencies that rely on standard JSON behavior.

Use with care in shared or library-heavy environments.

---

## License

BSD2-Clause

---

## Statuses

[![pipeline status](https://gitlab.com/viraven/pyjsony/badges/main/pipeline.svg)](https://gitlab.com/viraven/pyjsony/-/commits/main)
