Find JSON data paths by value
Project description
JSONCHICK
Get paths to a value in JSON data.
Install
pip install jsonchick
Use
from jsonchick import jsonchick
data = [{'k1': 'v1'}, [{'k2': ['v1']]]
value = 'v1'
assert (('k1',), ('k2', 0)) == jsonchick.find(value, data)
assert [['k1'], ['k2', 0]] == jsonchick.find(value, data, mutable=True)
Credits
The lib is a modified version of a Stackoverflow answer on the question: https://stackoverflow.com/questions/31010299/json-get-key-path-in-nested-dictionary
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
jsonchick-0.0.1.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for jsonchick-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c25ed5a6dbecd05bf876b099c8d762a6fe5d32d52cc56d3b6b6dc9cdf59bcc0e |
|
MD5 | 4aed545826d0a645cee767ab6e9fb33d |
|
BLAKE2b-256 | 334130503b99c7b7aa2653148a54474980789c87b4578c5d9a5a6c500a603ac9 |