A small Python package for cleaning, validating, inspecting, comparing, and converting JSON-like data.
Project description
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:
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
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}}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
altrepo_json-0.1.0.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file altrepo_json-0.1.0.tar.gz.
File metadata
- Download URL: altrepo_json-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25466962910c30af74580422c47c6e8778b6d1efdfa94e71d3f4ded54bcbd0ce
|
|
| MD5 |
9af1abab57a171231f056b2916c3ebe9
|
|
| BLAKE2b-256 |
b6627c9cca4c96db789615c82c2bd54658e4ceeae5275016e6f8d6870365d3c0
|
File details
Details for the file altrepo_json-0.1.0-py3-none-any.whl.
File metadata
- Download URL: altrepo_json-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a07701ecb88afd8429afa38b44e04beadac950aae735f04a565f392b4741e01
|
|
| MD5 |
afcbe5d4ea2c61242d2a923969596df7
|
|
| BLAKE2b-256 |
b8efcc834a6cee5be72137a530e1ba3c0fc43e2cfcdb802e3bdd3b7fc0028044
|