Skip to main content

A pythonic, extensible JSON Schema implementation.

Project description

Test Status Code Coverage PyPI Package Version Python Versions Documentation Status License

jschon is a pythonic and extensible implementation of the JSON Schema specification.


  • JSON Schema validator implementation (drafts 2019-09, 2020-12)

    • Schema compilation and indexing

    • $ref loading from local and remote sources

    • Support for custom keywords, vocabularies and meta-schemas

    • Support for format validation

  • JSON class implementing the JSON data model

  • JSON Pointer (RFC 6901)

  • JSON Patch (RFC 6902)

  • Relative JSON Pointer (draft)


pip install jschon

For remote $ref support, the requests library is required. It may be installed with:

pip install jschon[requests]


Create a JSON schema:

from jschon import create_catalog, JSON, JSONSchema


demo_schema = JSONSchema({
    "$id": "",
    "$schema": "",
    "type": "array",
    "items": {
        "anyOf": [
                "type": "string",
                "description": "Cool! We got a string here!"
                "type": "integer",
                "description": "Hey! We got an integer here!"

Validate JSON data:

result = demo_schema.evaluate(
    JSON([12, "Monkeys"])

Generate JSON Schema-conformant output:

>>> result.output('basic')
    "valid": True,
    "annotations": [
            "instanceLocation": "",
            "keywordLocation": "/items",
            "absoluteKeywordLocation": "",
            "annotation": True
            "instanceLocation": "/0",
            "keywordLocation": "/items/anyOf/1/description",
            "absoluteKeywordLocation": "",
            "annotation": "Hey! We got an integer here!"
            "instanceLocation": "/1",
            "keywordLocation": "/items/anyOf/0/description",
            "absoluteKeywordLocation": "",
            "annotation": "Cool! We got a string here!"

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jschon-0.9.0.tar.gz (41.0 kB view hashes)

Uploaded source

Built Distribution

jschon-0.9.0-py3-none-any.whl (55.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page