🌐
jsonschema
python-jsonschema.readthedocs.io
jsonschema 4.26.0 documentation
PyPI version Supported Python versions Build status ReadTheDocs status pre-commit.ci status Zenodo DOI jsonschema is an implementation of the JSON Schema specification for Python. It can also be us...
🌐
GitHub
github.com › python-jsonschema
Python + JSON Schema · GitHub
JSON Schema implementation and surrounding tooling for Python - Python + JSON Schema
Discussions

I wrote okjson - A fast, simple, and pythonic JSON Schema Validator
https://github.com/mufeedvh/okjson/blob/main/okjson/validator.py It's useful to use a formatter/linter and configure your text editor to be aligned with the linter. $> pylint okjson | grep 'Bad indentation' | wc -l 100 black is a popular formatter used by the community. https://github.com/psf/black pylint is a useful listing tool. https://pylint.pycqa.org/en/latest/ Best of luck to you on your project. More on reddit.com
🌐 r/Python
4
14
March 31, 2022
multi agent - Generate a JSON Schema specification from Python classes - Stack Overflow
Introduction Hello everyone ! I am trying to develop multi-agent models in Python3. So my approach is to create basic classes and derive them to more concrete and specific ones. For instance, a class More on stackoverflow.com
🌐 stackoverflow.com
Data validation with JSON schema
I really dislike how JSONSchema considers every property as optional by default. It should have been the other way around. Every property that I define a type for should have been required unless it is marked optional. It sounds much more sensible: If I defined an age field that is an integer in a specific range I expect it to be present. Specifying types for properties that might or might not be there sounds like the less likely case to me. More on reddit.com
🌐 r/programming
13
8
July 23, 2021
Swaggerspect: JSON schema for python API:s
Strange naming. Swagger was the name before openapi 3.0 spec (eg 2.0 and 1.0 were swagger - you can download the spec file of most APIs and the first line usually tells you which of the 3 versions it follows) Now openapi is the spec and swagger is the suite of tools used to validate openapi spec and more More on reddit.com
🌐 r/Python
2
13
July 3, 2024
🌐
PyPI
pypi.org › project › jsonschema
jsonschema · PyPI
An implementation of JSON Schema validation for Python
      » pip install jsonschema
    
Published   Jan 07, 2026
Version   4.26.0
🌐
Pydantic
docs.pydantic.dev › latest › concepts › json_schema
JSON Schema - Pydantic Validation
Specify the mode of JSON schema generation via the mode parameter in the model_json_schema and TypeAdapter.json_schema methods. By default, the mode is set to 'validation', which produces a JSON schema corresponding to the model's validation schema. The JsonSchemaMode is a type alias that represents the available options for the mode parameter:
🌐
Reddit
reddit.com › r/python › i wrote okjson - a fast, simple, and pythonic json schema validator
r/Python on Reddit: I wrote okjson - A fast, simple, and pythonic JSON Schema Validator
March 31, 2022 -

I had a requirement to process and validate large payloads of JSON concurrently for a web service, initially I implemented it using jsonschema and fastjsonschema but I found the whole JSON Schema Specification to be confusing at times and on top of that wanted better performance. Albeit there are ways to compile/cache the schema, I wanted to move away from the schema specification so I wrote a validation library inspired by the design of tiangolo/sqlmodel (type hints) to solve this problem easier.

Here is a simple example:

from okjson import JSONValidator

schema = { 'name': str, 'age': int }

json_string = '{ "name": "Charly Gordon", "age": 32 }'

assert JSONValidator().is_valid(instance=json_string, schema=schema)

There is an example covering all the features in the README.

It also has well defined exceptions for each error case when you want to get the reason for the validation failure. (Helpful when you want to show user facing error messages)

GitHub: https://github.com/mufeedvh/okjson

This is my first time publishing a Python library, please share your feedback/suggestions. :)

🌐
SageMath
doc.sagemath.org › html › en › reference › spkg › jsonschema.html
jsonschema: Python implementation of JSON Schema - Packages and Features
jsonschema is an implementation of JSON Schema for Python · Home page: http://github.com/Julian/jsonschema
🌐
GeeksforGeeks
geeksforgeeks.org › python › introduction-to-python-jsonschema
Introduction to Python jsonschema - GeeksforGeeks
July 23, 2025 - It is widely used in APIs, configuration files, and data interchange formats to ensure that the data adheres to a defined standard. The jsonschema is a Python library used for validating JSON data against a schema.
Find elsewhere
🌐
Python
docs.python.org › 3 › library › json.html
json — JSON encoder and decoder
3 weeks ago - Source code: Lib/json/__init__.py JSON (JavaScript Object Notation), specified by RFC 7159(which obsoletes RFC 4627) and by ECMA-404, is a lightweight data interchange format inspired by JavaScript...
🌐
FreshPorts
freshports.org › devel › py-jsonschema
FreshPorts -- devel/py-jsonschema: JSON Schema validation for Python
jsonschema is an implementation of JSON Schema for Python - Full support for Draft 3 and Draft 4 of the schema. - Lazy validation that can iteratively report all validation errors. - Small and extensible - Programmatic querying of which properties or items failed validation.
🌐
Medium
medium.com › @erick.peirson › type-checking-with-json-schema-in-python-3244f3917329
Type checking with JSON Schema in Python | by Erick Peirson | Medium
April 26, 2019 - From an early phase of the arXiv Next Generation project, we’ve enjoyed adopting type annotations (PEP 484, PEP 526) using Python’s native typing library (since Python 3.5) and the mypy static type checker, which we run as part of our continuous integration workflow. While there was a bit of an acclimation curve, this has (I believe) led to cleaner, more readable code. At around the same time, we adopted JSON Schema to describe resources exposed by both internal and public REST APIs, and began using the jsonschema Python package in API tests.
🌐
Stackademic
blog.stackademic.com › mastering-json-schema-validation-with-python-a-developers-guide-0bbf25513630
Mastering JSON Schema Validation with Python: A Developer’s Guide | by Utkarsh Singh | Stackademic
February 16, 2024 - JSON Schema sets the stage by defining the acceptable data types (like strings, integers, arrays) and structures (such as specific properties within objects). It provides a comprehensive guide for shaping your JSON data.
🌐
JSON Schema
json-schema.org › tools
JSON Schema - Tools
Bowtie is a meta-validator for JSON Schema implementations and it provides compliance reports.
🌐
Plain English
python.plainenglish.io › json-schema-a-practical-python-library-2a8ab08a4d3f
JSON schema, a practical Python library! | by Beck Moulton | Python in Plain English
November 18, 2024 - JSON schema, a practical Python library! Hello everyone, today I will share with you a practical Python library — json schema. Github address: https://github.com/python-jsonschema/jsonschema In …
🌐
JSON Schema
json-schema.org
JSON Schema
Please visit the JSON Schema Landscape and discover more companies using JSON Schema · While JSON is probably the most popular format for exchanging data, JSON Schema is the vocabulary that enables JSON data consistency, validity, and interoperability at scale
Top answer
1 of 1
1

Pydantic can help you achieve this:

Example from the Pydantic documentation

from enum import Enum
from pydantic import BaseModel, Field


class FooBar(BaseModel):
    count: int
    size: float = None


class Gender(str, Enum):
    male = 'male'
    female = 'female'
    other = 'other'
    not_given = 'not_given'


class MainModel(BaseModel):
    """
    This is the description of the main model
    """

    foo_bar: FooBar = Field(...)
    gender: Gender = Field(None, alias='Gender')
    snap: int = Field(
        42,
        title='The Snap',
        description='this is the value of snap',
        gt=30,
        lt=50,
    )

    class Config:
        title = 'Main'


# this is equivalent to json.dumps(MainModel.schema(), indent=2):
print(MainModel.schema_json(indent=2))

Output:

# this is equivalent to json.dumps(MainModel.schema(), indent=2):
print(MainModel.schema_json(indent=2))

{
  "title": "Main",
  "description": "This is the description of the main model",
  "type": "object",
  "properties": {
    "foo_bar": {
      "$ref": "#/definitions/FooBar"
    },
    "Gender": {
      "$ref": "#/definitions/Gender"
    },
    "snap": {
      "title": "The Snap",
      "description": "this is the value of snap",
      "default": 42,
      "exclusiveMinimum": 30,
      "exclusiveMaximum": 50,
      "type": "integer"
    }
  },
  "required": [
    "foo_bar"
  ],
  "definitions": {
    "FooBar": {
      "title": "FooBar",
      "type": "object",
      "properties": {
        "count": {
          "title": "Count",
          "type": "integer"
        },
        "size": {
          "title": "Size",
          "type": "number"
        }
      },
      "required": [
        "count"
      ]
    },
    "Gender": {
      "title": "Gender",
      "description": "An enumeration.",
      "enum": [
        "male",
        "female",
        "other",
        "not_given"
      ],
      "type": "string"
    }
  }
}
🌐
DEV Community
dev.to › stefanalfbo › python-json-schema-3o7n
Python JSON schema - DEV Community
May 9, 2024 - JSON Schema can be a great tool to document this contract, define constraints and validate the contract. In Python we can use the jsonschema library to enable the power of JSON Schema in our projects.
🌐
GitConnected
levelup.gitconnected.com › building-an-ai-agent-from-scratch-with-pure-python-7d4532202637
Building an AI Agent from Scratch with pure Python | by Christian Bernecker | Feb, 2026 | Level Up Coding
4 weeks ago - To truly master AI, you need to build one from the ground up using raw Python and direct API calls. ... In this guide, we will build a Structured Plan-and-Execute Agent. While often grouped under the “ReAct” umbrella, this architecture is more robust for complex workflows because it breaks down a query into a JSON-based task list before execution.
🌐
jsonschema
python-jsonschema.readthedocs.io › en › latest › referencing
JSON (Schema) Referencing - jsonschema 4.26.1.dev25+gad0a1b301 documentation
from referencing import Registry, Resource schema = Resource.from_contents( { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "integer", "minimum": 0, }, ) registry = Registry().with_resources( [ ("http://example.com/nonneg-int-schema", schema), ("urn:nonneg-integer-schema", schema), ], ) What’s above is likely mostly self-explanatory, other than the presence of the referencing.Resource.from_contents function. Its purpose is to convert a piece of “opaque” JSON (or really a Python dict containing deserialized JSON) into an object which indicates what version of JSON Schema the schema is meant to be interpreted under.
🌐
PyPI
pypi.org › project › jsonschema-rs
jsonschema-rs - A high-performance JSON Schema validator ...
A high-performance JSON Schema validator for Python
      » pip install jsonschema-rs