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.4.tar.gz (7.8 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.4-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jflat-0.1.4.tar.gz
  • Upload date:
  • Size: 7.8 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.4.tar.gz
Algorithm Hash digest
SHA256 80f3be91e88f45ac5925d821c22f51490bba13949d7a10f3318e735dfe9c8a72
MD5 3dc956f3377f0733e3a5b9b92c714bb4
BLAKE2b-256 76a011b58f28b731969a48c1694af295a8d531a869850e69eaf1e1b1731cfd14

See more details on using hashes here.

Provenance

The following attestation bundles were made for jflat-0.1.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: jflat-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f31c30532b9944947ea5cd83ce1d0c57ca33b5d3e5ed0cf31adc0378fcdd33a5
MD5 2d762fdb230e421f6df0739c7a4fd816
BLAKE2b-256 d61d1d2c38cd856a688de3a74d2100583a38df942a6db5f9b9fad4745251b02c

See more details on using hashes here.

Provenance

The following attestation bundles were made for jflat-0.1.4-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