Skip to main content

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}}

Browser version

AltRepo JSON is part of the AltRepo tool ecosystem.

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

Project details


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.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

altrepo_json-0.1.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file altrepo_json-0.1.2.tar.gz.

File metadata

  • Download URL: altrepo_json-0.1.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for altrepo_json-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e0a68254bd885a8dc172f273ee9be460cb7990abdba71b86ed2e096a6840c019
MD5 672e28841bd6d13e6d71988466484bd4
BLAKE2b-256 62130364b81e1830d34491253f5b11cd314a5b4298ea7c25c5e4466ee51f6e39

See more details on using hashes here.

File details

Details for the file altrepo_json-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: altrepo_json-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for altrepo_json-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ab4173a4dbafe1ca22ca571d70e791674407a6e86eb96cdb821ecab1fbbea35
MD5 bccb1763bd76e5ee37bdc99eec397a46
BLAKE2b-256 e3240af127b3f4cae3441cb12f2ba861b9163bc0e6c7f1a47728089a4ebe9abf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page