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.2.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.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jflat-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 01a4172ddeab58fb629c65bfbf7fa49e317cea93acc51f3a870e8a3c5889a9ad
MD5 d24e0726064df0a157a04074113773e9
BLAKE2b-256 6272d47f30cbb5c03841e1d082a8cc6a77d259856851d50bc3a1075f6267685b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: jflat-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a3a1b9223d2871395ec19092340fde56f72f13541a45a69e5a9bd45bdbccff3
MD5 c672443d8dba2d9d1451ac34ae2d36d9
BLAKE2b-256 03877e990b8fe4d6bb439a7178fd51b4e2ec2e72968d38cee9087e976273a5cd

See more details on using hashes here.

Provenance

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