jschon


Namejschon JSON
Version 0.11.1 PyPI version JSON
download
home_pagehttps://github.com/marksparkza/jschon
SummaryA JSON toolkit for Python developers.
upload_time2023-10-22 11:38:58
maintainer
docs_urlNone
authorMark Jacobson
requires_python~=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            jschon
======

|python| |pypi| |docs| |tests| |codecov| |license| |downloads|

A JSON toolkit for Python developers.

Features
--------
* JSON Schema validator implementation
  (`drafts 2019-09, 2020-12 <https://json-schema.org/>`_)

  * 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 <https://tools.ietf.org/html/rfc6901.html>`_)
* JSON Patch (`RFC 6902 <https://tools.ietf.org/html/rfc6902.html>`_)
* Relative JSON Pointer (`draft <https://datatracker.ietf.org/doc/html/draft-bhutton-relative-json-pointer-00>`_)

Installation
------------
::

    pip install jschon

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

    pip install jschon[requests]

Basic usage
-----------
Create a JSON schema:

.. code-block:: python

    from jschon import create_catalog, JSON, JSONSchema

    create_catalog('2020-12')

    demo_schema = JSONSchema({
        "$id": "https://example.com/demo",
        "$schema": "https://json-schema.org/draft/2020-12/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:

.. code-block:: python

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

Generate JSON Schema-conformant output:

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

Links
-----
* `Documentation <https://jschon.readthedocs.io>`_
* `Package info <https://pypi.org/project/jschon>`_
* `Source code <https://github.com/marksparkza/jschon>`_

.. |tests| image:: https://github.com/marksparkza/jschon/actions/workflows/tests.yml/badge.svg
    :target: https://github.com/marksparkza/jschon/actions/workflows/tests.yml
    :alt: Test status

.. |codecov| image:: https://codecov.io/gh/marksparkza/jschon/branch/main/graph/badge.svg
    :target: https://codecov.io/gh/marksparkza/jschon
    :alt: Code coverage

.. |pypi| image:: https://img.shields.io/pypi/v/jschon
    :target: https://pypi.org/project/jschon
    :alt: PyPI package version

.. |python| image:: https://img.shields.io/pypi/pyversions/jschon
    :target: https://www.python.org/downloads/
    :alt: Supported Python versions

.. |docs| image:: https://readthedocs.org/projects/jschon/badge/?version=latest
    :target: https://jschon.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation status

.. |license| image:: https://img.shields.io/github/license/marksparkza/jschon
    :target: https://github.com/marksparkza/jschon/blob/main/LICENSE
    :alt: MIT license

.. |downloads| image:: https://static.pepy.tech/badge/jschon
    :target: https://pepy.tech/project/jschon
    :alt: Total downloads

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/marksparkza/jschon",
    "name": "jschon",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Mark Jacobson",
    "author_email": "mark@saeon.ac.za",
    "download_url": "https://files.pythonhosted.org/packages/7b/8b/5cbfbb4751533027ba97a59dfe4c9e694fbceaf549fa9cd7cb9a6066bd60/jschon-0.11.1.tar.gz",
    "platform": null,
    "description": "jschon\n======\n\n|python| |pypi| |docs| |tests| |codecov| |license| |downloads|\n\nA JSON toolkit for Python developers.\n\nFeatures\n--------\n* JSON Schema validator implementation\n  (`drafts 2019-09, 2020-12 <https://json-schema.org/>`_)\n\n  * Schema compilation and indexing\n  * $ref loading from local and remote sources\n  * Support for custom keywords, vocabularies and meta-schemas\n  * Support for format validation\n\n* JSON class implementing the JSON data model\n* JSON Pointer (`RFC 6901 <https://tools.ietf.org/html/rfc6901.html>`_)\n* JSON Patch (`RFC 6902 <https://tools.ietf.org/html/rfc6902.html>`_)\n* Relative JSON Pointer (`draft <https://datatracker.ietf.org/doc/html/draft-bhutton-relative-json-pointer-00>`_)\n\nInstallation\n------------\n::\n\n    pip install jschon\n\nFor remote $ref support, the requests library is required. It may be installed with::\n\n    pip install jschon[requests]\n\nBasic usage\n-----------\nCreate a JSON schema:\n\n.. code-block:: python\n\n    from jschon import create_catalog, JSON, JSONSchema\n\n    create_catalog('2020-12')\n\n    demo_schema = JSONSchema({\n        \"$id\": \"https://example.com/demo\",\n        \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n        \"type\": \"array\",\n        \"items\": {\n            \"anyOf\": [\n                {\n                    \"type\": \"string\",\n                    \"description\": \"Cool! We got a string here!\"\n                },\n                {\n                    \"type\": \"integer\",\n                    \"description\": \"Hey! We got an integer here!\"\n                }\n            ]\n        }\n    })\n\nValidate JSON data:\n\n.. code-block:: python\n\n    result = demo_schema.evaluate(\n        JSON([12, \"Monkeys\"])\n    )\n\nGenerate JSON Schema-conformant output:\n\n>>> result.output('basic')\n{\n    \"valid\": True,\n    \"annotations\": [\n        {\n            \"instanceLocation\": \"\",\n            \"keywordLocation\": \"/items\",\n            \"absoluteKeywordLocation\": \"https://example.com/demo#/items\",\n            \"annotation\": True\n        },\n        {\n            \"instanceLocation\": \"/0\",\n            \"keywordLocation\": \"/items/anyOf/1/description\",\n            \"absoluteKeywordLocation\": \"https://example.com/demo#/items/anyOf/1/description\",\n            \"annotation\": \"Hey! We got an integer here!\"\n        },\n        {\n            \"instanceLocation\": \"/1\",\n            \"keywordLocation\": \"/items/anyOf/0/description\",\n            \"absoluteKeywordLocation\": \"https://example.com/demo#/items/anyOf/0/description\",\n            \"annotation\": \"Cool! We got a string here!\"\n        }\n    ]\n}\n\nLinks\n-----\n* `Documentation <https://jschon.readthedocs.io>`_\n* `Package info <https://pypi.org/project/jschon>`_\n* `Source code <https://github.com/marksparkza/jschon>`_\n\n.. |tests| image:: https://github.com/marksparkza/jschon/actions/workflows/tests.yml/badge.svg\n    :target: https://github.com/marksparkza/jschon/actions/workflows/tests.yml\n    :alt: Test status\n\n.. |codecov| image:: https://codecov.io/gh/marksparkza/jschon/branch/main/graph/badge.svg\n    :target: https://codecov.io/gh/marksparkza/jschon\n    :alt: Code coverage\n\n.. |pypi| image:: https://img.shields.io/pypi/v/jschon\n    :target: https://pypi.org/project/jschon\n    :alt: PyPI package version\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/jschon\n    :target: https://www.python.org/downloads/\n    :alt: Supported Python versions\n\n.. |docs| image:: https://readthedocs.org/projects/jschon/badge/?version=latest\n    :target: https://jschon.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation status\n\n.. |license| image:: https://img.shields.io/github/license/marksparkza/jschon\n    :target: https://github.com/marksparkza/jschon/blob/main/LICENSE\n    :alt: MIT license\n\n.. |downloads| image:: https://static.pepy.tech/badge/jschon\n    :target: https://pepy.tech/project/jschon\n    :alt: Total downloads\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A JSON toolkit for Python developers.",
    "version": "0.11.1",
    "project_urls": {
        "Homepage": "https://github.com/marksparkza/jschon"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ceb131f454a2ac0d23b0a47283d115f0af4abe2a1ea391f5ccb223e02d685b82",
                "md5": "efc85f7cb234c64ab90a7046f2a92919",
                "sha256": "2350e8b6747b17358022960f91208bea70de448b914827af3184d30e20500f0f"
            },
            "downloads": -1,
            "filename": "jschon-0.11.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "efc85f7cb234c64ab90a7046f2a92919",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 66971,
            "upload_time": "2023-10-22T11:38:57",
            "upload_time_iso_8601": "2023-10-22T11:38:57.475367Z",
            "url": "https://files.pythonhosted.org/packages/ce/b1/31f454a2ac0d23b0a47283d115f0af4abe2a1ea391f5ccb223e02d685b82/jschon-0.11.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b8b5cbfbb4751533027ba97a59dfe4c9e694fbceaf549fa9cd7cb9a6066bd60",
                "md5": "d2dc7ab5b97355ccfb0b72cb61ed87ac",
                "sha256": "c0ca0beab1f1694a03d726b91ed75ec604a7787af3ae91ead765f78215bf149f"
            },
            "downloads": -1,
            "filename": "jschon-0.11.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d2dc7ab5b97355ccfb0b72cb61ed87ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 69411,
            "upload_time": "2023-10-22T11:38:58",
            "upload_time_iso_8601": "2023-10-22T11:38:58.897333Z",
            "url": "https://files.pythonhosted.org/packages/7b/8b/5cbfbb4751533027ba97a59dfe4c9e694fbceaf549fa9cd7cb9a6066bd60/jschon-0.11.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-22 11:38:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "marksparkza",
    "github_project": "jschon",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "jschon"
}
        
Elapsed time: 0.21006s