Skip to main content

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.

nothoney

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


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.2.tar.gz (2.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page