skillfed

genson

GenSON is a powerful, user-friendly JSON Schema generator.

genson v1.4.0 19.4M downloads/30d#1,068 on PyPI725
Permissive license MIT Active released

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 genson

uv

uv add genson

poetry

poetry add genson

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: File Formats :: JSON :: JSON SchemaTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

json schema generatorinfer schema from jsonmerge json schemasjson object to schemaschema builder pythonjson validation schemagenerate jsonschema
json-schemacode-generationdata-validation

More Python Modules packages