Skip to main content

Ensure nested dictionary structure.

Project description


Ever have JSON or a large dictionary that you want to validate before you jump deeper into it? PyChecKey allows you to check a dictionary-like object against a defined structure.

This works with Python 3.5+.


A KeyEnsurer allows checking against a dictionary-like structure.

from pycheckey import KeyEnsurer

data = {
    "key1": 4,
    "key2": {
        "innerKey": "hi"

ensurer = KeyEnsurer(data=data, required_keys=['key1', 'key2.innerKey', 'key3'])

ensurer.validate()  # Will return false because key3 does not exist!
print(ensurer.missing)  # ['key3']

ensurer.key_exists(data, 'key2.inner')  # Returns true because data[key2][inner] exists

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

pycheckey-0.2.tar.gz (1.8 kB view hashes)

Uploaded source

Built Distribution

pycheckey-0.2-py3-none-any.whl (2.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page