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.3.tar.gz (7.6 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.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jflat-0.1.3.tar.gz
  • Upload date:
  • Size: 7.6 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.3.tar.gz
Algorithm Hash digest
SHA256 1a98bc4dfb6027d833c7db669caf8cd9c0cceb49e8ee5d1e8c8221514615d498
MD5 f3b18c40bf9a21917c90c0baa4cdad2e
BLAKE2b-256 a62f52a667a3a3365c3a289598568ae0d964d23365d59f5d5593aa56f629c8e1

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: jflat-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4d183dcc4a2facdb09e3f616b3f43c64aebec68ac9a86b18382b078ee12ffa7f
MD5 b6b855a11366f87e7ac21ed6892ff04b
BLAKE2b-256 30f298978563c1cc5ee3364bfc08fb2b5252b749f68c1b5bc140654e650ba443

See more details on using hashes here.

Provenance

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