genson
GenSON is a powerful, user-friendly JSON Schema generator.
What it is and what it does
GenSON is a JSON Schema generator that takes JSON objects as input and produces JSON Schema documents describing their structure. Its core strength is the ability to merge schemas: you can feed it multiple JSON objects or existing schemas, and it will generate a single unified schema that accommodates all of them. The package follows three guiding rules: every input object must validate under the generated schema, any object valid under any input schema must also validate under the output, and the schema should be as strict as possible given those constraints.
The package works with JSON Schema Draft 6 and above, though it uses only a subset of JSON Schema's keywords (type, properties, items, required, anyOf, enum, and a few others). It includes both a Python API via the SchemaBuilder class and a command-line tool for schema generation. GenSON is designed to help you skip boilerplate schema writing by inferring basic structure from your data, leaving detailed constraints for manual refinement.
Use it for:
- Automatically generate baseline JSON Schema from sample API responses to jumpstart validation rules.
- Merge schemas from multiple data sources to find the common structure across heterogeneous datasets.
- Build schema validators for incoming JSON data by inferring constraints from known-good examples.
- Generate documentation schemas from production JSON objects without manual schema authoring.
- Combine hand-written schemas with inferred ones to progressively refine data validation rules.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
GenSON generates JSON Schema documents from JSON objects and can merge multiple schemas together, inferring a unified schema that describes the common structure of your data.
Yes. GenSON is actively maintained, has no external dependencies, supports current Python versions (3.10+), carries no known vulnerabilities, and solves a real problem—automating the tedious first step of schema creation. Use it when you need to generate or merge JSON schemas from data samples or existing schemas. The permissive MIT license poses no restriction.
Install
genson on PyPI
pip
pip install gensonuv
uv add gensonpoetry
poetry add gensonInstalling genson
Before you install
Low install friction with no runtime dependencies. Actively maintained as of 2026-07-06 with recent release history and stable production status.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install genson
from genson import SchemaBuilder
builder = SchemaBuilder()
builder.add_object({"name": "Alice", "age": 30})
builder.add_object({"name": "Bob"})
schema = builder.to_schema()
print(schema)
Requires Python 3.10 or later.
Verify before relying
- Whether the package handles deeply nested or very large JSON structures efficiently.
- Performance characteristics when merging hundreds or thousands of schemas.
- Extent of customization available through extensibility for non-standard merging behavior.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 39 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 19,370,440/month — #1,068 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: genson-1.4.0-py3-none-any.whl
Keywords: json, schema, json-schema, jsonschema, object, generate, generator, builder, merge, draft 7, validate, validation
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
warchant_dc_schemaGenerates JSON Schema (2020-12 draft) from…
permissive · top 15,000 on PyPI
marshmallow-jsonschemaConverts marshmallow schemas into JSON Schema…
permissive · top 5,000 on PyPI
jsonmergeMerges multiple JSON documents into a single…
permissive · top 5,000 on PyPI
jschonValidates JSON data against JSON Schema (drafts…
permissive · top 15,000 on PyPI
jsonschema-typed-v2Generates Python TypedDict type annotations…
permissive · top 15,000 on PyPI
dydanticDynamically generates Pydantic models from JSON…
permissive · top 5,000 on PyPI
jsonschema-pydantic-converterConverts JSON Schema definitions to Pydantic v2…
permissive · top 15,000 on PyPI
jsonschema2mdConverts JSON Schema files to human-readable…
permissive · top 5,000 on PyPI
json-schema-for-humansGenerates static HTML or Markdown documentation…
permissive · top 5,000 on PyPI
json-strong-typingSerializes Python dataclasses to JSON and…
permissive · top 15,000 on PyPI