json-flattener
Python library for denormalizing nested dicts or json objects to tables and back
What it is and what it does
json-flattener transforms nested JSON, YAML, or JSON-Lines data into flat tabular rows where each top-level key becomes a column. Nested objects are flattened by concatenating keys with underscores (e.g., creator.name becomes creator_name), and lists of objects are converted into parallel lists within cells. The library also supports serializing complex fields as embedded JSON or YAML strings, and can reverse the process to reconstruct the original nested structure from flattened data.
The primary use case is preparing normalized data models for tools that expect tabular input: Pandas dataframes, Excel, SQL databases, Solr/Lucene indexes, or Unix text processing. It ships with a command-line tool (jfl) for batch operations and can be used programmatically from Python. The package depends only on click and pyyaml, making it lightweight to install.
Use it for:
- Export nested API responses or document databases to CSV/TSV for analysis in spreadsheets or Pandas.
- Prepare hierarchical YAML configuration or data files for indexing in Solr or Lucene.
- Convert complex Python objects to flat rows for import into SQL databases without manual schema design.
- Denormalize LinkML or other schema-driven data for downstream data science workflows.
- Round-trip nested data through tabular formats while preserving the ability to reconstruct the original structure.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts nested JSON/YAML objects into flat tabular rows suitable for dataframes, spreadsheets, or databases, with the ability to round-trip back to the original structure.
Yes, if you need to flatten nested JSON/YAML to tabular format and can tolerate dormant maintenance. The package is stable, has no known vulnerabilities, installs with minimal friction, and solves a specific problem well. However, do not expect active development or bug fixes—evaluate whether the current feature set meets your needs before committing to a dependency.
Install
json-flattener on PyPI
pip
pip install json-flatteneruv
uv add json-flattenerpoetry
poetry add json-flattenerInstalling json-flattener
Before you install
Low friction: pure Python wheel with only click and pyyaml as runtime dependencies. Maintenance is dormant—last release was 2022-02-26 and no commits since 2024-03-21—so expect no active bug fixes or feature development.
License in practice
BSD permissive license means you can use, modify, and distribute the package freely in commercial or private projects with minimal restrictions.
Quickstart
pip install json-flattener
from json_flattener import Flattener
flattener = Flattener()
flat_rows = flattener.flatten([{"id": "1", "creator": {"name": "Author"}}])
Requires Python 3.7 or later.
Verify before relying
- Whether the library handles deeply nested structures beyond one level of flattening (description mentions 'currently one level' but scope unclear).
- Performance characteristics on large datasets or whether there are memory constraints.
- Whether unflatten operation preserves all data fidelity in round-trip scenarios.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.7.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — click, pyyaml |
| Maintenance | dormant — 1,630 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 301,821/month — #7,831 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: json_flattener-0.1.9-py3-none-any.whl
Keywords: linkml, data-science, denormalization, yaml, json, data-frames
Tags
More Bio-Informatics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
biopythonBiopython provides Python tools for…
unclear · top 5,000 on PyPI
firecrawl-pyClient library for the Firecrawl API that…
permissive · top 5,000 on PyPI
intervaltreeA self-balancing interval tree data structure…
permissive · top 5,000 on PyPI
albumentationsAlbumentations applies image transformations to…
permissive · top 5,000 on PyPI
PubChemPyPubChemPy is a Python wrapper around the…
permissive · top 5,000 on PyPI
flatten-jsonConverts nested JSON objects into flat…
permissive · top 5,000 on PyPI
pandas-read-xmlConverts XML files into pandas DataFrames, with…
permissive · top 15,000 on PyPI
flatten-dictConverts nested dictionaries into flat…
permissive · top 5,000 on PyPI
tablibTablib converts tabular data between multiple…
permissive · top 5,000 on PyPI
deflate-dictFlattens nested dictionaries into single-level…
permissive · top 15,000 on PyPI
flatdictFlattens nested dictionaries into single-level…
permissive · top 5,000 on PyPI
json-tools-rsFlattens and unflattens nested JSON structures…
permissive · top 15,000 on PyPI
json-flattenConverts nested JSON objects into flat…
permissive · top 15,000 on PyPI
mltableMLTable provides fast, flexible data loading…
unclear · top 15,000 on PyPI
json2htmlConverts JSON data structures into HTML tables…
permissive · top 5,000 on PyPI