Registry / data / json-flattener

json-flattener

JSON →
library0.1.9pypypi✓ verified 82d ago

Python library for denormalizing nested dicts or JSON objects to tabular form (CSV, TSV, Excel) and back. Current version 0.2.0, with a new poetry-based build and improved error handling. Maintained by the OBO Foundry community. Releases are occasional.

pip install json-flattener
INSTALL
IMPORT
SIG · JSON-FLATTENER
J
json-flattener
datapythonv0.1.9
Install
1.8s avg
Import
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.9 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 22MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

flatten
from json_flattener import flatten
from json_flattener import JsonFlattener
unflatten
from json_flattener import unflatten
GlobalConfig
from json_flattener import GlobalConfig

Flatten a nested dictionary to a flat dictionary with dot-separated keys.

from json_flattener import flatten nested = {'a': 1, 'b': {'c': 2, 'd': [3, 4]}} flat = flatten(nested) print(flat) # Output: {'a': 1, 'b__c': 2, 'b__d__0': 3, 'b__d__1': 4}
Debug
Known issues
gotchaThe default separator is '__' (double underscore), not '.'. Many users expect a dot separator. You can customize with the 'sep' argument.
fix
Use flatten(nested, sep='.') for dot notation.
affects: all
gotchaFlattening a list inside a dict creates keys with numeric indices (e.g., 'b__d__0'). This may not match your schema expectations.
fix
Post-process keys or use a different flattening library if you need custom list handling.
affects: all
Upgrade
Version history
0.1.9latest on PyPI · released Feb 26, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
json-flattener — pip install json-flattener · libregistry