Metadata-Version: 2.4
Name: neatjson
Version: 0.10.7
Summary: Pretty-print your JSON with more power than json.dumps provides.
Author-email: Gavin Kistner <gavin@phrogz.net>
Maintainer-email: Gavin Kistner <gavin@phrogz.net>
License: MIT
Project-URL: Homepage, https://github.com/Phrogz/NeatJSON
Project-URL: Documentation, https://github.com/Phrogz/NeatJSON#readme
Project-URL: Repository, https://github.com/Phrogz/NeatJSON
Project-URL: Issues, https://github.com/Phrogz/NeatJSON/issues
Keywords: json,pretty-print,formatting,serialization
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: General
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"

# NeatJSON for Python

Pretty-print your JSON in Python with more power than `json.dumps` provides.

See the [main project README](../README.md) for full documentation.

## Installation

```bash
pip install neatjson
```

## Quick Start

```python
from neatjson import neat_json

data = {"b": 42.005, "a": [42, 17], "longer": True, "str": "yes\nplease"}

# Compact output (default)
print(neat_json(data))
# {"b":42.005,"a":[42,17],"longer":true,"str":"yes\nplease"}

# Sorted keys
print(neat_json(data, sort=True))
# {"a":[42,17],"b":42.005,"longer":true,"str":"yes\nplease"}

# Wrapped with indentation
print(neat_json(data, sort=True, wrap=40))
# {
#   "a":[42,17],
#   "b":42.005,
#   "longer":true,
#   "str":"yes\nplease"
# }
```

## Python-Specific Features

The following Python types are automatically handled:

- **Tuples, sets, and frozensets** are serialized as JSON arrays
- **Other iterables** (`range`, `deque`, generators, etc.) are serialized as arrays
- **namedtuple** instances are serialized as JSON objects (using field names as keys)
- **dataclasses** are serialized as JSON objects
- **Enum** values are serialized using their `.value`
- **Decimal** and **Fraction** are serialized as JSON numbers
- Objects with a `__json__()` method will have that method called for serialization

## Development

```bash
cd python
pip install -e ".[dev]"
pytest
```
