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: str): -> list
Returns a list of values that have the corresponding key chain.
Project details
Release history Release notifications | RSS feed
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.4.3.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for jsonparse-0.4.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3512b41f1121036448ccf9d8b897d907131edac719e9cd7f157ff07f5c9a3b9 |
|
MD5 | 838cb7322df807fe54b3e2b454404b91 |
|
BLAKE2b-256 | 62b12bf3aac55f43539cc1baeb20da91927b29ccb6ce1d106c3e9fc1b26d4ba5 |