Skip to main content

Search through JSON data key:vales by key

Project description

jsonparse

A simple JSON key parsing library. It's use-case is to extract the values from key:value pairs in JSON data.

Install

pip install jsonparse

Usage

from jsonparse import Parser

parse = Parser(stack_trace=False, queue_trace=False)
data = [
    {"key": 1},
    {"key": 2},
    {"my": 
        {"key": 
            {"chain":"A"}
        }
    }
]


print(parse.key(data, 'key'))
[{'chain': 'A'}, 2, 1]

print(parse.key_chain(data, ['my', 'key', 'chain']))
['A']

print(parse.key_chain(data, ['key']))
[1, 2]

API

key(data: dict | list, key: str): -> list

Returns a list of values that have the corresponding key.

key_chain(data: dict | list, keys: list): -> list

Returns a list of values that have the corresponding key chain.

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

jsonparse-0.5.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

jsonparse-0.5.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file jsonparse-0.5.0.tar.gz.

File metadata

  • Download URL: jsonparse-0.5.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for jsonparse-0.5.0.tar.gz
Algorithm Hash digest
SHA256 77e706e31186ea42b8ce4a1128b5a8e5895fd84a7688b47fb00a29082c2cb3f4
MD5 d1021e0044c953a76685ed7fa367afb3
BLAKE2b-256 65f4c9afd46304a106d6b8c67baa4ad7c72ad432884105a0080ce6e3fed8f5f8

See more details on using hashes here.

File details

Details for the file jsonparse-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: jsonparse-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for jsonparse-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0eb6294eef434c2cbb9765b4df55ccb78060063e86b5d75db009ab36faefeaf1
MD5 bf20d1cf75102365552c7e9aa387f9cb
BLAKE2b-256 b8ca311ef1ebbfb65fa01ccddcde0f815b5699647e692e2cf38dc0737f156136

See more details on using hashes here.

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