Skip to main content

json4humans

CI pre-commit.ci status Maintainability Test Coverage Documentation Status

Python tools for JSONC and JSON5 (aka. JSON for humans)

This package provider parsing and serialization (with style preservation) as well as linting, formatting and cli tools for JSON-derived syntaxes.

Getting started

Add json4humans as a dependency to your project:

# pip
pip install json4humans
# pipenv
pipenv install json4humans
# PDM
pdm add json4humans

Then import the proper module and use it like you would with the builtin json module:

from pathlib import Path
from json4humans import json

my_file = Path(__file__).parent / "my_file.json"

# Load data
with my_file.open() as f:
    data = json.load(f)

# Edit
data["attr"] = "value"

# Save with style preservation
with my_file.open("w") as out:
    json.dump(out, data)

Features

  • Manipulate all supported format with the exact same API. Currently supported:
  • Parsed data supports native types comparison while preserving style
  • Support serialization for both native types and provided JSONType
  • Supports formatting
  • Supports linting
  • All features availables as a standalone cli
  • Support jq-like queries

Documentation

Documentation is available at https://json4humans.rtfd.io

Contributing

Read the dedicated contributing guidelines.

Release files for json4humans 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json4humans 0.1.0
File Size Uploaded
json4humans-0.1.0.tar.gz 16.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for json4humans 0.1.0
File Interpreter ABI Platform
json4humans-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / json4humans-0.1.0.tar.gz

Download URL json4humans-0.1.0.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
79f5fb997ffc93d464e2c56091842a840fa86835f174f73f67ab1ed5653c2330
BLAKE2b-256 checksum
How to use checksums
fe892b29b6182f8c100d530763413f9acad2a3711f8f7f308c517aa964fdc96d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.1.0 CPython/3.10.5

Release files / json4humans-0.1.0-py3-none-any.whl

Download URL json4humans-0.1.0-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8762f56a0200ba71c5af70fb61d04f05369bec4a1da0f4d192dbf0411e589a86
BLAKE2b-256 checksum
How to use checksums
1a716063b4a50f2859f00807b61306f8f567a3ec68dc9d1d439ee03320f80ea4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.1.0 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page