JSON schema validator.
Project description
JsonVL
JsonVL is a JSON validator for Python. This project is intended to be a replacement for the jsonschema package which implements the JSON Schema standard. JsonVL's goal is to curate a rich set of validation methods for JSON data types while remaining extensible to new constraints.
Installation
Install the latest PyPI release:
pip install jsonvl
Usage
Validate JSON files from the command line
jsonvl data.json schema.json
Validate JSON files in Python
from jsonvl import validate_file
validate_file('data.json', 'schema.json')
Validate in-memory JSON data in Python
from jsonvl import validate
validate(data, schema)
Documentation
The JsonVL documentation is hosted by Read the Docs and is a work in progress.
Example
Below is an example pair of JSON data and JSON schema. More examples can be found in the examples folder.
Data
{
"play": "A Midsummer Night's Dream",
"characters": [
{ "name": "Helena", "loves": ["Demitrius"] },
{ "name": "Demitrius", "loves": ["Hermia", "Helena"] },
{ "name": "Hermia", "loves": ["Lysander"] },
{ "name": "Lysander", "loves": ["Hermia", "Helena", "Hermia"] },
{ "name": "Titania", "loves": ["Oberon", "Bottom", "Oberon"] },
{ "name": "Oberon", "loves": ["Titania"] },
{ "name": "Bottom", "loves": [] },
{ "name": "Puck", "loves": [] }
]
}
Schema
{
"type": "object",
"attr": {
"play": "string",
"characters": {
"type": "array",
"cons": {
"unique": "@all.name"
},
"elem": {
"type": "object",
"attr": {
"name": "#name",
"loves": {
"type": "array",
"elem": "#name",
"cons": { "max_size": 4 }
}
}
}
}
},
"defs": {
"#name": {
"type": "string",
"cons": {
"format": { "type": "regex", "pattern": "[A-Z][a-z]{0,10}" }
}
}
}
}
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 jsonvl-0.5.0.tar.gz.
File metadata
- Download URL: jsonvl-0.5.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efd755aa3f8b85d63c0415cdd2a49f8438bf30c83f33fe1e8367214221636c70
|
|
| MD5 |
1a78447d2153d93ed91314b6f01660aa
|
|
| BLAKE2b-256 |
94190a3ef4d4390e7fbbbecbd8d28fd6d5f69362e6415ce7ab3cd5bb64a8edc5
|
File details
Details for the file jsonvl-0.5.0-py3-none-any.whl.
File metadata
- Download URL: jsonvl-0.5.0-py3-none-any.whl
- Upload date:
- Size: 28.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17fd296cae13a35c172a89c15b1497958f9fb32827830af9f0ce8a11abc490bd
|
|
| MD5 |
e9820bb5c2444ab440801fec10edb129
|
|
| BLAKE2b-256 |
b3c5fcb8e5c93d41a9e65eb6e0d241b3017dd93d532a498f89dc2551d86a94ee
|