JSON Validation Schema
- Free software: MIT license
- Documentation: https://jsonvalidate.readthedocs.io.
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))