No project description provided
Project description
dict2rel
dict2rel is a Python library which can transform JSON with any level of nesting into one or more tables which contain enough information that the tables can be modified and then converted back to the nested JSON format. Essentially, JSON can be converted to relational tables and then back.
Table of Contents
Installation
pip install dict2rel
Quick Start
from dict2rel import dict2rel
import pandas as pd # you can also use polars.DataFrame
tables = dict2rel(
[
{
"name": "relay-settings",
"version": {
"major": 1,
"minor": 12,
"patch": 1
},
"settings": [
{
"key": "tempo",
"value": 12
},
{
"key": "delay",
"value": 14
}
]
},
{
"name": "response-settings",
"version": {
"major": 12,
"minor": 0,
"patch": 3
},
"settings": [
{
"key": "throttle",
"value": "always"
},
{
"key": "burst",
"value": 0.43
}
]
},
],
pd.DataFrame # the tables will be of this type
)
tables will end up being a dict of the following tables:
*
| name | version.major | version.minor | version.patch | _id |
|---|---|---|---|---|
| relay-settings | 1 | 12 | 1 | 0 |
| response-settings | 12 | 0 | 3 | 1 |
*.settings
| key | value | _id |
|---|---|---|
| tempo | 12 | 0.settings.0 |
| delay | 14 | 0.settings.1 |
| throttle | always | 1.settings.0 |
| burst | 0.43 | 1.settings.1 |
These tables can then be modified, maybe by adding a new column:
tables["*.settings"]["added"] = ["2025-12-18"] * len(tables["*.settings"])
and then converted back to nested JSON:
from dict2rel import rel2dict
transformed_data = rel2dict(tables)
which gives the following JSON:
[
{
"name": "relay-settings",
"version": {"major": 1, "minor": 12, "patch": 1},
"settings": [
{"key": "tempo", "value": 12, "added": "2025-12-18"},
{"key": "delay", "value": 14, "added": "2025-12-18"}
]
},
{
"name": "response-settings",
"version": {"major": 12, "minor": 0, "patch": 3},
"settings": [
{"key": "throttle", "value": "always", "added": "2025-12-18"},
{"key": "burst", "value": 0.43, "added": "2025-12-18"}
]
}
]
License
dict2rel is distributed under the terms of the MIT license.
Development
Make sure to run hatch fmt, hatch run black:run, hatch run test:run, and hatch run docs:build.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dict2rel-0.0.2.tar.gz.
File metadata
- Download URL: dict2rel-0.0.2.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
887e0496cd1071dfea68a914758e0631494c373eec81992afb54e251ea319222
|
|
| MD5 |
6c5e9f0f8f6b2d37d3fd6e8a6a5ca2a2
|
|
| BLAKE2b-256 |
0b21344660d36dcd770542c4aa43abf17c143ae552f52ac49607a89353f849c2
|
Provenance
The following attestation bundles were made for dict2rel-0.0.2.tar.gz:
Publisher:
publish.yml on BlendingJake/Dict2Rel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dict2rel-0.0.2.tar.gz -
Subject digest:
887e0496cd1071dfea68a914758e0631494c373eec81992afb54e251ea319222 - Sigstore transparency entry: 772502517
- Sigstore integration time:
-
Permalink:
BlendingJake/Dict2Rel@eb80e4a16c0a1568719f6912e40c1003b1819b9c -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/BlendingJake
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@eb80e4a16c0a1568719f6912e40c1003b1819b9c -
Trigger Event:
release
-
Statement type:
File details
Details for the file dict2rel-0.0.2-py3-none-any.whl.
File metadata
- Download URL: dict2rel-0.0.2-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
608b7481b2a05c79e6cac70a97fc86a73b71c3fd299d3ddff82bd9bc18e5bf07
|
|
| MD5 |
b88968e32d385454f33c3f8d953bc56a
|
|
| BLAKE2b-256 |
3d71fd4a4aa49b08ae1ec6fb575b55d69ee51909e6e85d58959b920534ad5a24
|
Provenance
The following attestation bundles were made for dict2rel-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on BlendingJake/Dict2Rel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dict2rel-0.0.2-py3-none-any.whl -
Subject digest:
608b7481b2a05c79e6cac70a97fc86a73b71c3fd299d3ddff82bd9bc18e5bf07 - Sigstore transparency entry: 772502519
- Sigstore integration time:
-
Permalink:
BlendingJake/Dict2Rel@eb80e4a16c0a1568719f6912e40c1003b1819b9c -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/BlendingJake
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@eb80e4a16c0a1568719f6912e40c1003b1819b9c -
Trigger Event:
release
-
Statement type: