This package helps you validate dictionaries against a defined schema
Project description
Json Validator
A simple json validaor that validates a json object against a provided schema
Features
- Validates a json object against a provided schema
Tech Stack
Python3
Installation
pip3 install python-jsonvalidator
Usage/Examples
from jsonvalidator import jsonvalidator
schema = {
"name": ["required", "string"],
"phone": ["required", "string"],
"email": ["required", "string"],
"test": ["required", "boolean"],
"job": {
"title": ["required", "string"],
"department": ["required", "string"],
"salary": [
{
"gross": ["required", "float"],
"net": ["required", "float"],
},
],
},
"pet_names": ["required", "list"],
}
json_object = {
"name": "John Doe",
"phone": "+1 5555 5555",
"email": "email",
"test": True,
"job": {
"title": "Software Engineer",
"department": "Engineering",
"salary": [
{
"gross": 50000.00,
"net": 50000.00,
},
],
},
"pet_names": ["my pet"],
}
print(json_validator.validate_json(schema=schema, json_object=json_object)) # returns a json object
License
Authors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-jsonvalidator-0.0.2.tar.gz.
File metadata
- Download URL: python-jsonvalidator-0.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3469ad8afdf6a17642ed774ed1ef9013117002f2d291e68647be0f4b06cf3a9d
|
|
| MD5 |
b8182fc5868d0345efe34d2d59e87408
|
|
| BLAKE2b-256 |
826ea9e7218545ab32166f4977c0c63c3016f60752dcc69a1241665040f17746
|
File details
Details for the file python_jsonvalidator-0.0.2-py2.py3-none-any.whl.
File metadata
- Download URL: python_jsonvalidator-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f26b9cd7f0c0a2530880e7c21902353b5a8a1bdd7a417b29b29d6dd9184b004
|
|
| MD5 |
05e06c504d0af74d7912530437b9dd3b
|
|
| BLAKE2b-256 |
ac348721560bf2cc6e45cf7964b51278ed43610536d651afac910a8f0c9a7a2c
|