Json Validator
A json validator focused on speed.
Not recursion
Works with Python 2.7.x, 3.4.x, 3.5.x, 3.6. It may work with 3.7.X
Constrains based on python types.
Lazy Validation
Constrain definitions with python types
from json_validator import JsonValidator
constrain = {
'string': {}, # str by default.
'integer': {'type': int},
'float': {'type': float},
'boolean': {'type': bool},
'json': {'type': dict },
'list': {'type': list},
'extra_1': {},
'extra_2': {},
}
json = {
'string': 'foo',
'integer': 42,
'float': 1.10,
'boolean': True
}
# accepts json string, dict and lists.
res, err = JsonValidator(constrain).validate(json)
res == json # => True
err == {'extra_1': 'Missing field', 'extra_2': 'Missing field'} # => True
See all rules for fields here.
Install
pip install sonic182_json_validator
Development
Install packages with pip-tools:
pip install pip-tools
pip-compile
pip-compile dev-requirements.in
pip-sync requirements.txt dev-requirements.txt
TODO
Documentation about rules.
Contribute
Fork
create a branch feature/your_feature
commit - push - pull request
Thanks :)
Release files for sonic182_json_validator 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sonic182_json_validator-1.0.2.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sonic182_json_validator-1.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 11.4 kB
Release files / sonic182_json_validator-1.0.2.tar.gz
| Download URL | sonic182_json_validator-1.0.2.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63e099e392c4c98e298d3b6b1da6249ac4490a210b17faa5a18b5333edc742ca
|
|
BLAKE2b-256 checksum How to use checksums |
87a5966baf0c4a112260813c3a990dfcb6a100b38f9a167ee1c4641f0ea78f68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / sonic182_json_validator-1.0.2-py2.py3-none-any.whl
| Download URL | sonic182_json_validator-1.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
453d42653d6919ee652cd97977e616b3ad1e89fafdf09304eda15945e01ff9b5
|
|
BLAKE2b-256 checksum How to use checksums |
b66c853df194a9588238821c02230e858614c7f37dc86f185688dcba1ef53309
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |