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 ((0, 'k1'), (1, 0, 'k2', 0)) == jsonchick.get_tuples(value, data)
assert [[0, 'k1'], [1, 0, 'k2', 0]] == jsonchick.get_lists(value, data)
assert ['[0]["k1"]', '[1][0]["k2"][0]'] == jsonchick.get_strings(value, data)
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.2.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for jsonchick-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97f662beb7f240434add650d3b0eabc55825b61d6c67da45e49b56c36855f3d7 |
|
MD5 | b121d373faaeb45be65c9aa14a49ee4d |
|
BLAKE2b-256 | 0eea1dec75e595316d4c3ac42de440a0a6678800458f8ced1e19bab4293c190c |