recursively iterate through a nested (n-deep) dictionary or JSON object/file
Project description
nothoney
This is a small Python package that is able to recursively iterate through a nested (n-deep) dictionary or JSON object/file to retrieve data.
So how do I fly this thing?
Install:
pip install nothoney --user
or
python setup.py install --user
Basic usage:
>>> import nothoney
>>> test
{'x': [{'a': 'b', 'c': {'foo': 'hello'}}, {'y': 'z', 'blah': {'lala': 'funfun', 'foo': 'world'}}]}
>>> nothoney.eat(test, 'foo')
['hello', 'world']
>>> nothoney.eat(test, 'funfun', mode='value')
['lala']
File mode (test.json):
[
{
"a": "b",
"c": {
"foo": "boom goes the dynamite!"
}
},
{
"x": "y",
"z": [
{
"lalala": {
"foo": "gotem coach!",
"random": "stuff",
"here": 1337
}
}
]
}
]
>>> nothoney.eat('test.json', 'foo', as_file=True)
['boom goes the dynamite!', 'gotem coach!']
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
nothoney-0.1.1.tar.gz
(2.9 kB
view details)
File details
Details for the file nothoney-0.1.1.tar.gz.
File metadata
- Download URL: nothoney-0.1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbffdb6ea98a0edd8867660551de06ec9e3438c1d28a4767d93b3a3609bd52f2
|
|
| MD5 |
bd3bbaed9dd26b54017101382e39e3ab
|
|
| BLAKE2b-256 |
14046bb17a049e67365e52df224e434db31e2000374b6ebf4ce69c594b16b14d
|