flatten-dict
A flexible utility for flattening and unflattening dict-like objects in Python.
Decision gist · record as of 2026-08-14
Yes. The package is lightweight, dependency-free, actively maintained, has no known vulnerabilities, and solves a common data-transformation problem with a clean API. Install it if you regularly work with nested dictionaries or need flexible dict flattening/unflattening.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with no runtime dependencies and active maintenance (last commit 2026-08-06, release 108 days ago).
- Supports Python 3.10–3.14.
License · maintenance · safety
MIT (permissive) — MIT license (permissive); you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2026-04-28 (108 days) · last repo commit 2026-08-06 · 184 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,136,768 downloads/mo, #2,373 on PyPI
Alternatives
Verify before relying
from flatten_dict import flatten, unflatten
nested = {'a': '0', 'b': {'a': '1.0', 'b': '1.1'}}
flat = flatten(nested, reducer='dot')
# {'a': '0', 'b.a': '1.0', 'b.b': '1.1'}
reconstructed = unflatten(flat, splitter='dot')
# {'a': '0', 'b': {'a': '1.0', 'b': '1.1'}}What it is and what it does
flatten-dict provides two core functions: `flatten()` transforms nested dict-like objects into a single-level dictionary with composite keys, and `unflatten()` reverses the process. The package supports multiple key-joining strategies—tuples, filesystem paths, underscores, dots, or custom callables—letting you choose how nested keys combine. You can also enumerate sequences (lists) as indexed keys, preserve or discard empty containers, limit flattening depth, and invert keys and values.
The package is useful when you need to serialize hierarchical data into flat form for storage, comparison, or API transmission, or when you need to reconstruct nested structures from flat representations. It has no external dependencies and works across modern Python versions.
Use it for
- Convert nested configuration objects into flat key-value pairs for environment variable mapping or flat file storage.
- Flatten API responses or JSON payloads to extract all leaf values with their full key paths.
- Transform flat dictionaries back into nested structures for hierarchical data reconstruction.
- Enumerate list indices as keys to treat sequences uniformly with nested dicts during flattening.
- Customize key joining with domain-specific delimiters or logic via callable reducers.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is lightweight, dependency-free, actively maintained, has no known vulnerabilities, and solves a common data-transformation problem with a clean API. Install it if you regularly work with nested dictionaries or need flexible dict flattening/unflattening.
Install
flatten-dict on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies and active maintenance (last commit 2026-08-06, release 108 days ago). Supports Python 3.10–3.14.
License in practice
MIT license (permissive); you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
from flatten_dict import flatten, unflatten
nested = {'a': '0', 'b': {'a': '1.0', 'b': '1.1'}}
flat = flatten(nested, reducer='dot')
# {'a': '0', 'b.a': '1.0', 'b.b': '1.1'}
reconstructed = unflatten(flat, splitter='dot')
# {'a': '0', 'b': {'a': '1.0', 'b': '1.1'}}
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 108 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,136,768 / month, #2,373 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Utilities |
Evidence: flatten_dict-0.5.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “nested dict to flat”
- flatten-dictConverts nested dictionaries into flat key-value pairs and back, with…
- deflate-dictFlattens nested dictionaries into single-level key-value pairs using…
- json-normalizeRecursively flattens nested JSON-like structures (dicts and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also flatten-json · json-flatten · optree · flatdict · json-tools-rs · deflate-dict · json-flattener · zict · etuples · multidict