https://github.com/vesche/nothoney
recursively iterate through a nested (n-deep) dictionary or JSON object/file
https://github.com/vesche/nothoney
dictionary json nested recursion
Last synced: about 1 month ago
JSON representation
recursively iterate through a nested (n-deep) dictionary or JSON object/file
- Host: GitHub
- URL: https://github.com/vesche/nothoney
- Owner: vesche
- License: unlicense
- Created: 2021-06-13T16:07:36.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-20T04:07:08.000Z (over 3 years ago)
- Last Synced: 2025-03-17T06:38:44.078Z (about 1 year ago)
- Topics: dictionary, json, nested, recursion
- Language: Python
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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:
```python
>>> 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):
```json
[
{
"a": "b",
"c": {
"foo": "boom goes the dynamite!"
}
},
{
"x": "y",
"z": [
{
"lalala": {
"foo": "gotem coach!",
"random": "stuff",
"here": 1337
}
}
]
}
]
```
```python
>>> nothoney.eat('test.json', 'foo', as_file=True)
['boom goes the dynamite!', 'gotem coach!']
```