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}" }
}
}
}
}
Metadata
Release files for jsonvl 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsonvl-0.5.0.tar.gz | 18.7 kB | Without provenance | Details for jsonvl-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsonvl-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for jsonvl-0.5.0-py3-none-any.whl |
Total release size: 47.0 kB
Release files / jsonvl-0.5.0.tar.gz
| Download URL | jsonvl-0.5.0.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
efd755aa3f8b85d63c0415cdd2a49f8438bf30c83f33fe1e8367214221636c70
|
|
BLAKE2b-256 checksum How to use checksums |
94190a3ef4d4390e7fbbbecbd8d28fd6d5f69362e6415ce7ab3cd5bb64a8edc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / jsonvl-0.5.0-py3-none-any.whl
| Download URL | jsonvl-0.5.0-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17fd296cae13a35c172a89c15b1497958f9fb32827830af9f0ce8a11abc490bd
|
|
BLAKE2b-256 checksum How to use checksums |
b3c5fcb8e5c93d41a9e65eb6e0d241b3017dd93d532a498f89dc2551d86a94ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for jsonvl 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.