json-flatten
Python functions for flattening a JSON object to a single dictionary of pairs, and unflattening that dictionary back to a JSON object
What it is and what it does
json-flatten provides two core functions: flatten() converts a nested JSON dictionary into a single-level dictionary with dot-notation keys and type suffixes (e.g., `user.age$int`), and unflatten() reverses the process. It preserves type information for integers, floats, booleans, nulls, and empty containers through suffix markers, and represents list indices using bracket notation like `items.[0]`.
The package is designed for scenarios where you need to represent JSON as HTML form data or URL query parameters—contexts where nested structures don't map naturally. It handles arbitrarily nested objects and lists, including matrices and mixed nesting patterns, all without external dependencies.
Use it for:
- Serialize nested JSON to HTML form fields while preserving type information for round-trip conversion.
- Encode complex JSON structures as URL query string parameters for API requests.
- Flatten configuration objects for storage in flat key-value databases or environment variables.
- Convert JSON payloads to flat dictionaries for compatibility with legacy systems expecting single-level data.
- Debug and inspect deeply nested JSON by viewing all paths and values in a single flat view.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts nested JSON objects into flat key-value dictionaries and back, preserving types using suffix notation, useful for HTML forms or query string parameters.
Yes, if you need JSON flattening with type preservation and have no special Python version requirements. The zero-dependency design and low install friction make it straightforward to add. However, the aging maintenance status (706 days since last release) means you should verify it handles your specific JSON structures before relying on it in production; consider forking or monitoring the repository if you need ongoing support.
Install
json-flatten on PyPI
pip
pip install json-flattenuv
uv add json-flattenpoetry
poetry add json-flattenInstalling json-flatten
Before you install
Low friction: no runtime dependencies, pure Python wheel. Aging maintenance status—last release was 706 days ago and repository shows no recent activity, though it remains unarchived.
License in practice
Apache License 2.0 is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install json-flatten
import json_flatten
flat = json_flatten.flatten({"foo": {"bar": [1, True, None]}})
original = json_flatten.unflatten(flat)
Verify before relying
- Whether the package handles edge cases like circular references or very deeply nested structures.
- Performance characteristics on large or complex JSON structures.
- Python version compatibility (requires_python is unspecified in metadata).
Package facts
| License | Apache License, Version 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 706 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 538,007/month — #6,117 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: json_flatten-0.3.1-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
flatten-dictConverts nested dictionaries into flat…
permissive · top 5,000 on PyPI
flatten-jsonConverts nested JSON objects into flat…
permissive · top 5,000 on PyPI
jsonableProvides an abstract base class for defining…
permissive · top 15,000 on PyPI
json-tools-rsFlattens and unflattens nested JSON structures…
permissive · top 15,000 on PyPI
deflate-dictFlattens nested dictionaries into single-level…
permissive · top 15,000 on PyPI
magicattrProvides nested attribute access and…
permissive · top 5,000 on PyPI
flatdictFlattens nested dictionaries into single-level…
permissive · top 5,000 on PyPI
dynamodb-jsonConverts Python objects to and from DynamoDB's…
unclear · top 5,000 on PyPI
json-normalizeRecursively flattens nested JSON-like…
permissive · top 15,000 on PyPI
dm-treeProvides utilities for working with nested data…
permissive · top 5,000 on PyPI