Skip to main content

A humble library for flattening Python dictionaries according to their JSON-path

Project description

jflat

A humble library for flattening Python dictionaries according to their JSON-paths.

Installation

pip install jflat

Usage

from jflat import flatten, unflatten

data = {
    "a": {
        "b": {
            "c": True
        }
    },
    "list": [ 1, 2, 3 ]
}

flattened = flatten(data)
print(flattened)
# {
#     "$.a.b.c": True,
#     "$.list[0]": 1,
#     "$.list[1]": 2,
#     "$.list[2]": 3
# }

unflattened = unflatten(flattened)
print(unflattened)
# {
#     "a": {
#         "b": {
#             "c": True
#         }
#     },
#     "list": [ 1, 2, 3 ]
# }

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jflat-0.1.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jflat-0.1.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file jflat-0.1.1.tar.gz.

File metadata

  • Download URL: jflat-0.1.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jflat-0.1.1.tar.gz
Algorithm Hash digest
SHA256 00e45e4336294dc338b78c0f15ff94826f583f3008c32627ac9049ca5ad625ed
MD5 a65312da9aed409102481d59ad9989c8
BLAKE2b-256 30d84a9782f136de2ad04654c08b6c00529b8d5e83400a36ea8d444ab4c6db9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for jflat-0.1.1.tar.gz:

Publisher: release.yml on merschformann/jflat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jflat-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: jflat-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jflat-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa766623b851728f0193fa4d1b5f76116e79fd03b6e8922769dbc097a04da642
MD5 e2ab34e18895a2f28a329507587b59ed
BLAKE2b-256 a00502aa277908927240d7a9fc2dddad8bfa2a0febd233fa1df0174a67e11984

See more details on using hashes here.

Provenance

The following attestation bundles were made for jflat-0.1.1-py3-none-any.whl:

Publisher: release.yml on merschformann/jflat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page