---
title: "jsonschema | pypx"
description: "An implementation of JSON Schema validation for Python"
canonical_url: "https://pypx.app/packages/jsonschema"
meta:
  "og:description": "An implementation of JSON Schema validation for Python"
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_jsonschema%2Cversion_4.26.0%2Csummary_An%2Bimplementation%2Bof%2BJSON%2BSchema%2Bvalidation%2Bfor%2BPython%2Clicense_MIT%2Cp_Ii9wYWNrYWdlcy9qc29uc2NoZW1hIg%2Cs_BxfhlKUFJwCGDB7e.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "jsonschema 4.26.0"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_jsonschema%2Cversion_4.26.0%2Csummary_An%2Bimplementation%2Bof%2BJSON%2BSchema%2Bvalidation%2Bfor%2BPython%2Clicense_MIT%2Cp_Ii9wYWNrYWdlcy9qc29uc2NoZW1hIg%2Cs_BxfhlKUFJwCGDB7e.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **jsonschema**

v4.26.0

An implementation of JSON Schema validation for Python

89 KB Python 3.10+ py3-none-anyMIT4 deps

[** Diff **](https://pypx.app/packages/jsonschema/diff)

`$ uv add jsonschema`

==========

# jsonschema

[![PyPI version](https://img.shields.io/pypi/v/jsonschema.svg)](https://pypi.org/project/jsonschema/) [![Supported Python versions](https://img.shields.io/pypi/pyversions/jsonschema.svg)](https://pypi.org/project/jsonschema/) [![Build status](https://github.com/python-jsonschema/jsonschema/workflows/CI/badge.svg)](https://github.com/python-jsonschema/jsonschema/actions?query=workflow%3ACI) [![ReadTheDocs status](https://readthedocs.org/projects/python-jsonschema/badge/?version=stable&style=flat)](https://python-jsonschema.readthedocs.io/en/stable/) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/python-jsonschema/jsonschema/main.svg)](https://results.pre-commit.ci/latest/github/python-jsonschema/jsonschema/main) [![Zenodo DOI](https://zenodo.org/badge/3072629.svg)](https://zenodo.org/badge/latestdoi/3072629)

jsonschema is an implementation of the [JSON Schema](https://json-schema.org) specification for Python.

```python
>>> from jsonschema import validate

>>> # A sample schema, like what we'd get from json.load()
>>> schema = {
...     "type" : "object",
...     "properties" : {
...         "price" : {"type" : "number"},
...         "name" : {"type" : "string"},
...     },
... }

>>> # If no exception is raised by validate(), the instance is valid.
>>> validate(instance={"name" : "Eggs", "price" : 34.99}, schema=schema)

>>> validate(
...     instance={"name" : "Eggs", "price" : "Invalid"}, schema=schema,
... )                                   # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
    ...
ValidationError: 'Invalid' is not of type 'number'
```

It can also be used from the command line by installing [check-jsonschema](https://github.com/python-jsonschema/check-jsonschema).

## Features

- Full support for [Draft 2020-12](https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft202012Validator), [Draft 2019-09](https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft201909Validator), [Draft 7](https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft7Validator), [Draft 6](https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft6Validator), [Draft 4](https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft4Validator) and [Draft 3](https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft3Validator)

- [Lazy validation](https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/protocols/#jsonschema.protocols.Validator.iter_errors) that can iteratively report *all* validation errors.

- [Programmatic querying](https://python-jsonschema.readthedocs.io/en/latest/errors/) of which properties or items failed validation.

## Installation

jsonschema is available on [PyPI](https://pypi.org/project/jsonschema/). You can install using [pip](https://pip.pypa.io/en/stable/):

```bash
$ pip install jsonschema
```

# Extras

Two extras are available when installing the package, both currently related to format validation:

- format
- format-nongpl

They can be used when installing in order to include additional dependencies, e.g.:

```bash
$ pip install jsonschema'[format]'
```

Be aware that the mere presence of these dependencies – or even the specification of format checks in a schema – do *not* activate format checks (as per the specification). Please read the [format validation documentation](https://python-jsonschema.readthedocs.io/en/latest/validate/#validating-formats) for further details.

## About

I'm Julian Berman.

jsonschema is on [GitHub](https://github.com/python-jsonschema/jsonschema).

Get in touch, via GitHub or otherwise, if you've got something to contribute, it'd be most welcome!

If you feel overwhelmingly grateful, you can also [sponsor me](https://github.com/sponsors/Julian/).

And for companies who appreciate jsonschema and its continued support and growth, jsonschema is also now supportable via [TideLift](https://tidelift.com/subscription/pkg/pypi-jsonschema).

## Release Information

# v4.26.0

- Decrease import time by delaying importing of urllib.request (#1416).

## **Details **

<dl>

<dt>Version</dt>
<dd>4.26.0</dd>

<dt>License</dt>
<dd>MIT</dd>

<dt>Python</dt>
<dd>&gt;=3.10</dd>

<dt>Maintainer</dt>
<dd>Julian Berman &lt;Julian+jsonschema@GrayVines.com&gt;</dd></dl>

## **Links**

- [Changelog](https://github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst)
- [Documentation](https://python-jsonschema.readthedocs.io/)
- [Funding](https://github.com/sponsors/Julian)
- [Homepage](https://github.com/python-jsonschema/jsonschema)
- [Issues](https://github.com/python-jsonschema/jsonschema/issues/)
- [Source](https://github.com/python-jsonschema/jsonschema)
- [Tidelift](https://tidelift.com/subscription/pkg/pypi-jsonschema)
- [View on PyPI](https://pypi.org/project/jsonschema/)

## **Release Cadence **

**1**

releases in the past year

avg 47 days between releases

## **Maintainers **

- Julian Berman · [Julian+jsonschema@GrayVines.com](mailto:Julian+jsonschema@GrayVines.com)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/jsonschema#webpage","@type":"WebPage","description":"An implementation of JSON Schema validation for Python","name":"jsonschema","url":"https://pypx.app/packages/jsonschema","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/jsonschema"]}]},{"@id":"https://pypx.app/packages/jsonschema#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"An implementation of JSON Schema validation for Python","license":"MIT","name":"jsonschema","softwareVersion":"4.26.0"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
