--- id: jsonschema-pydantic-converter version: "0.4.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # jsonschema-pydantic-converter — Convert JSON Schema definitions to Pydantic models dynamically at runtime License: permissive · Maintenance: active · Downloads: 314.0K/mo ## What it is and what it does jsonschema-pydantic-converter bridges JSON Schema and Pydantic by transforming JSON Schema dictionaries into Pydantic v2 models or TypeAdapters at runtime. This is useful when you work with dynamic or externally-defined schemas—for example, when validating data against a JSON Schema specification that you don't know until runtime, or when integrating systems that use JSON Schema with Pydantic-based applications. The library handles a broad range of JSON Schema constructs: primitive types, arrays, nested objects, enums, union types (anyOf, oneOf), combined schemas (allOf), negation, constant values, and schema references ($ref, $defs). It preserves validation constraints like string length and pattern rules, numeric bounds, and array size limits. It also handles reserved Pydantic property names by renaming them internally while preserving the original JSON names through aliases. Use it for: - Validate incoming API payloads against a JSON Schema specification without manually writing Pydantic models. - Build schema-driven applications where the data model is defined externally or loaded from configuration files. - Bridge legacy JSON Schema-based systems with modern Pydantic-based codebases. - Generate TypeAdapters for direct JSON string validation and serialization without intermediate model definitions. - Handle dynamic or user-provided schemas in data processing pipelines where models cannot be hardcoded. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts JSON Schema definitions to Pydantic v2 models at runtime, enabling dynamic validation and serialization of data against JSON Schema specifications. Yes, with conditions. Install if you need to work with dynamic JSON Schemas and want Pydantic validation without writing models by hand. The library is actively maintained, has no known vulnerabilities, and low install friction. However, it is in Alpha status (first release 2025-11-12), so expect potential API changes and test thoroughly before using in production. ## Install pip install jsonschema-pydantic-converter uv add jsonschema-pydantic-converter poetry add jsonschema-pydantic-converter ## Installing jsonschema-pydantic-converter Before you install: Low install friction with a single runtime dependency on pydantic. Active maintenance with recent commits and no known vulnerabilities. Early-stage project (Alpha status, first release 2025-11-12) but receiving regular updates. License in practice: Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and state significant changes. Quickstart: from jsonschema_pydantic_converter import create_type_adapter schema = { "type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "integer"}}, "required": ["name"] } adapter = create_type_adapter(schema) user = adapter.validate_python({"name": "John", "age": 30}) Requires Python 3.10 or later and pydantic as a runtime dependency. Verify before relying: - Performance characteristics when converting large or deeply nested schemas at runtime. - Completeness of JSON Schema draft support (which draft versions are fully covered). - Behavior with circular or mutually recursive schema definitions beyond stated self-reference support. - Real-world production stability given Alpha status and limited adoption signals. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 314.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags json schema to pydantic model, dynamic pydantic model generation, json schema validation pydantic, convert json schema runtime, pydantic type adapter from schema, json schema bridge pydantic, schema-driven model creation, schema-validation, json-schema, dynamic-models [View on SkillFed](https://skillfed.io/packages/jsonschema-pydantic-converter) · [View on PyPI](https://pypi.org/project/jsonschema-pydantic-converter/)