Metadata-Version: 2.1 Name: jschon Version: 0.11.1 Summary: A JSON toolkit for Python developers. Home-page: https://github.com/marksparkza/jschon Author: Mark Jacobson Author-email: mark@saeon.ac.za License: MIT Classifier: Development Status :: 3 - Alpha Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Python: ~=3.8 Description-Content-Type: text/x-rst License-File: LICENSE Requires-Dist: rfc3986 Provides-Extra: dev Requires-Dist: pytest ; extra == 'dev' Requires-Dist: coverage ; extra == 'dev' Requires-Dist: hypothesis <6.0.4 ; extra == 'dev' Requires-Dist: pytest-benchmark ; extra == 'dev' Requires-Dist: pytest-httpserver ; extra == 'dev' Requires-Dist: requests ; extra == 'dev' Provides-Extra: doc Requires-Dist: sphinx ; extra == 'doc' Requires-Dist: sphinx-rtd-theme ; extra == 'doc' Provides-Extra: requests Requires-Dist: requests ; extra == 'requests' Provides-Extra: test Requires-Dist: tox ; extra == 'test' jschon ====== |python| |pypi| |docs| |tests| |codecov| |license| |downloads| A JSON toolkit for Python developers. Features -------- * 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 `_) 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 `_ * `Package info `_ * `Source code `_ .. |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