jsonvalidate

JSON validation Schema


Keywords
jsonvalidate, dict, json, json-schema, json-schema-validator
License
MIT
Install
pip install jsonvalidate==0.1.7

Documentation

JSON Validation Schema

JSON Validation Schema

Features

from jsonvalidate import Object, String, Integer

schema = Object({
    'email': String(regex='[^@]+@[^@]+\.[^@]+'),
    'name': String(),
    'age': Integer(enums=[5, 6, 7]),
    'address': Object({
        'permanent': String(),
        'temporary': String(min_length=3, enums=['asss', 's'])
    })
})

payload = {
    'email': 'robus@example.com',
    'name': 'robus',
    'age': 342,
    'address': {
        'permanent': 'sd',
        'temporary': 'asss'
    }

}

print(schema.check(payload))