jsonxplode
Efficient JSON flattening for complex nested structures
jsonxplode converts nested JSON structures into flat tabular format while preserving all data, including complex nested arrays and objects with arbitrary depth.
Version Update: v1.2.0
Bug fix
Relational Array Flattening - Arrays of different sizes are now also flattened relationally by default, preserving positional relationships:
Version Update: v1.1.0
Bug fix
Relational Array Flattening - Arrays of the same length are now flattened relationally by default, preserving positional relationships:
Control Relational Array Flattening
Control how arrays are flattened with the relational_array parameter:
# Default - preserves relationships between arrays
flattener = FlattenJson(relational_array=True)
# Independent flattening of arrays
flattener = FlattenJson(relational_array=False)
Example with Relational Flattening (Default)
data = {
"name": "John",
"a": [1, 2, 3],
"b": [1, 2, 3]
}
result = flattener.flatten(data)
Returns:
[
{"name": "John", "a": 1, "b": 1},
{"name": "John", "a": 2, "b": 2},
{"name": "John", "a": 3, "b": 3}
]
Installation
pip install jsonxplode
Usage
from jsonxplode import flatten
# Handles any JSON structure
data = {
"users": [
{"profile": {"name": "John", "settings": {"theme": "dark"}, "location": ["city1", "city2"]}},
{"profile": {"name": "Jane", "settings": {"theme": "light"}}}
]
}
flattened_data = flatten(data)
Returns:
[
{'users.profile.name': 'John', 'users.profile.settings.theme': 'dark', 'user.profile.location': 'city1'},
{'users.profile.name': 'John', 'users.profile.settings.theme': 'dark', 'user.profile.location': 'city2'},
{'users.profile.name': 'Jane', 'users.profile.settings.theme': 'light'}
]
DataFrame Output (Optional)
from jsonxplode import to_dataframe
# Requires pandas to be installed separately
df = to_dataframe(data)
Note: to_dataframe requires pandas (pip install pandas) but the core flatten function has zero dependencies.
Features
- Arbitrary nesting depth - handles deeply nested objects and arrays
- Conflict resolution - automatically manages key path conflicts
- Memory efficient - processes large datasets with minimal overhead
- Zero dependencies - pure Python implementation (core function)
- Array expansion - properly handles nested arrays with row duplication
Performance
- 7,900 rows with 23 columns processed in 0.146 seconds
- Memory usage: ~16MB for above mentioned workload
- Consistent performance across varying data structures
Metadata
Release files for jsonxplode 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsonxplode-1.2.1.tar.gz | 6.1 kB | Without provenance | Details for jsonxplode-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsonxplode-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for jsonxplode-1.2.1-py3-none-any.whl |
Total release size: 13.0 kB
Release files / jsonxplode-1.2.1.tar.gz
| Download URL | jsonxplode-1.2.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a3acabc6776025e8e4d9f1d1f0f15db23688f2d2402c49280e31975335aeb2d
|
|
BLAKE2b-256 checksum How to use checksums |
4a2c6136a4cc01ef8fa5fdf07abcdbd706822eb5fac46053fdec20e73d509868
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / jsonxplode-1.2.1-py3-none-any.whl
| Download URL | jsonxplode-1.2.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
994abf08c8a832797c304950695e6ceb335ca7668a352b0fe760ebd8366f4d4c
|
|
BLAKE2b-256 checksum How to use checksums |
23fe6d980faf956d3de6f09f84d116a68a3e9451d4d4dda26ebd1d7d3a102f77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for jsonxplode 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.