API Reference

jsonschema

An implementation of JSON Schema validation for Python, supporting draft 2020-12 and earlier versions.

Official Documentation ↗
CompatibilityThis documentation covers version v4.21. Check the official docs for the latest API surface.

Installation

pippip install jsonschema

Methods

jsonschema validates instances against schema documents and reports precise error paths.

Key Features

  • Multiple JSON Schema drafts
  • Detailed ValidationError messages
  • Format and custom validator support

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://python-jsonschema.readthedocs.io/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:36.315Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

Which draft should I target?
Use Draft 2020-12 for new schemas via the matching validator class; older drafts remain supported for compatibility.
How do I get all errors?
Iterate iter_errors instead of calling validate, which stops at the first failure and discards the rest.
Are formats like email checked by default?
Format checking is opt-in through a format checker; without it, format keywords are annotations only.