Skip to main content

A JSON helper for Python

Project description

This is a utility to make working with JSON files easier.

Installation

pip install jthon

Usage

import jthon
a_new_dict = {
    'fruits': {
        'pineapple':0,
        'apples': 2,
        'orange': 4,
        'pears': 1
    }
}
example = jthon.load('fruits', a_new_dict)
find = example.find(key='apple', exact=False)
for found in find:
    print("I've found '{}', with a value of '{}'.".format(found.key, found.value))
    print("{}".format(found.siblings))

print("There are {} oranges in the dict!".format(example.get('fruits').get('orange')))
example['fruits']['peach'] = 1
example.save()
print(example)

More examples can be found in the examples folder

Requirements

python3.6 >

Authors

License

This project is licensed under MIT - see the [LICENSE](LICENSE.txt) file for details

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

jthon-1.0.6.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

jthon-1.0.6-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

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