Metadata-Version: 2.4
Name: altrepo-json
Version: 0.1.2
Summary: A small Python package for cleaning, validating, inspecting, comparing, and converting JSON-like data.
Author-email: Example Author <author@example.com>
Project-URL: Homepage, https://altrepo.net
Project-URL: Repository, https://github.com/AltRepoYT/altrepo-json
Project-URL: Issues, https://github.com/AltRepoYT/altrepo-json/issues
Project-URL: Browser JSON Tool, https://altrepo.net/dev/json-formatter/
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Dynamic: license-file

# altrepo-json

A small Python package for cleaning, validating, inspecting, comparing, and converting JSON-like data.

## Installation

You can install this package locally for testing:

```bash
pip install -e .
```

## Features

- **Validate**: Check if data is valid JSON or conforms to expected basic shapes.
- **Format**: Pretty-print or minify JSON strings.
- **Inspect**: Analyze JSON structures to get depths, leaf nodes, or paths.
- **Flatten**: Flatten nested dictionaries into single-level maps with dotted keys, and unflatten them.
- **Path**: Retrieve or set values inside deep JSON structures using dot-notation paths.
- **Diff**: Compare two JSON objects and find differences.

## Usage

```python
from altrepo_json import flatten, unflatten, diff, path

# Flattening
data = {"user": {"profile": {"name": "Alice"}}}
flat_data = flatten(data)
# {'user.profile.name': 'Alice'}

# Path access
value = path.get_by_path(data, "user.profile.name")
# 'Alice'

# Diff
data2 = {"user": {"profile": {"name": "Bob", "age": 30}}}
differences = diff.diff(data, data2)
# {'modified': {'user.profile.name': ('Alice', 'Bob')}, 'added': {'user.profile.age': 30}}
```

## Browser version

AltRepo JSON is part of the AltRepo tool ecosystem.

Use the browser-based JSON tools here:
https://altrepo.net/dev/
