Skip to main content

Easier traversing and exploration of JSON structures

Project description

ez-json-traverse Build Status Supported Python Version License

For easier traversing and exploration of JSON structures.

Provides a traversable sequence EZJL, traversable mapping EZJD and convenience methods like as_traversable.

Starting off

$ pip install ez-json-traverse

followed by

from ezjt import as_traversable

Dict stuff

d = {
    'a': {'name': 'Jane', 'age': {'unit': 'year', 'value': 12}},
    'b': {'name': 'John', 'age': {'unit': 'year', 'value': 14}},
    'c': {'name': 'Jill', 'age': {'unit': 'year', 'value': 10}}
}

t = as_traversable(d, sep='.', map_char='^')  # EZJD

# Normal key access
t['a']  # EZJD of {'name': 'Jane', 'age': {'unit': 'year', 'value': 12}}

# Path key access
t['a.name']  # 'Jane'

# Mapping across values
t['^.age.value']  # EZJD of [12, 14, 10]

List stuff

l = [[0, [1, 2]], [1, [2, 3]], [2, [3, 4]]]

t = as_traversable(l, sep='.', map_char='^')  # EZJL

# Normal key access
t[0]  # EZJL of [0, [1, 2]]
t['0']  # EZJL of [0, [1, 2]]

# Path key access
t['0.1.0']  # 1

# Mapping across values
t[':^.1.0']  # EZJL of [1, 2, 3]
t['1:-1^.1.0']  # EZJL of [2] 

Other conveniences

t = as_traversable(..., sep='.', map_char='^')  # EZJL

t.parent  # Parent container
t.root  # Root container
t.path  # Path from root container to current traversable
t.key  # Final key or index of current traversable

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

ez-json-traverse-0.3.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

ez_json_traverse-0.3.3-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file ez-json-traverse-0.3.3.tar.gz.

File metadata

  • Download URL: ez-json-traverse-0.3.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for ez-json-traverse-0.3.3.tar.gz
Algorithm Hash digest
SHA256 bc7f384d79eed8cc18eb30976eb2a93466b8b50817526ff21cb5a59d768d31fa
MD5 aa706ee1243fd0a799de9bdbb415483a
BLAKE2b-256 3958568274a44ce61f05ca510b018b212ec96c60003012d16b163a00e82c3ddc

See more details on using hashes here.

File details

Details for the file ez_json_traverse-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: ez_json_traverse-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for ez_json_traverse-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c5e91cebed0942859950fe115fc18866c1a1178c23cc8cc7e2aaaf95f8829459
MD5 7c48c57b355f19f07a6f0f8b6760bb00
BLAKE2b-256 7bcde750c5246620d67dd8acc7d620ae00eb5e48a27ca7f516fca35d0d7736ce

See more details on using hashes here.

Supported by

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