Skip to main content

Tidy Byte Tools

schema-guess-lite

Tests License: MIT

Free tool that turns sample JSON, JSON Lines or CSV into a JSON Schema, Pydantic classes and TypedDict classes.

Need more than 50 records, or TypeScript, Zod, a strict schema for AI tool calls, or a drift report? See the pay-per-use version: JSON Schema generator.

Example

Input (customers.json):

[{"id": 1, "name": "Ann", "email": "ann@example.com", "address": {"city": "Austin"}},
 {"id": 2, "name": "Bo", "email": "bo@example.com", "address": null, "phone": "555"}]

Run:

schema-guess-lite customers.json

You get three files. customers.models.py looks like this:

from pydantic import BaseModel


class Address(BaseModel):
    city: str


class Customers(BaseModel):
    id: int
    name: str
    email: str
    address: Address | None
    phone: str | None = None

phone is optional because it is missing from one record. address can be null because one record has null. customers.schema.json is the matching JSON Schema, and customers.typed_dicts.py has TypedDict classes.

Plain code, not AI, so the same samples always give the same answer. Runs on your own computer. MIT license. Python 3.10 or newer, on Windows, Mac and Linux.

Also searched as: json to json schema, json to pydantic model, generate schema from sample data, csv to json schema, infer json schema

Install

pip install schema-guess-lite

Not on PyPI yet? Install from GitHub: pip install git+https://github.com/tidybytetools/schema-guess-lite

Use it

schema-guess-lite FILE...                 # saves FILE.schema.json, FILE.models.py, FILE.typed_dicts.py
schema-guess-lite data.json -n Customer   # name the top-level class
schema-guess-lite reply.json -p data.items  # the records are inside the JSON at data.items
schema-guess-lite data.json --print pydantic
cat sample.json | schema-guess-lite - --json   # one JSON object, for scripts and AI agents

Python:

from schema_guess_lite import guess
r = guess(open("customers.json").read(), "Customer")
r["jsonSchema"], r["pydantic"], r["typedDict"]

For AI agents (MCP)

Start the MCP server with uvx schema-guess-lite mcp. Two tools:

  • guess_schema (read only): sample text or a file path in, schema and code out.
  • save_schema_files: writes the three files into a folder you name.

Example config for Claude Desktop or Cursor:

{"mcpServers": {"schema-guess-lite": {"command": "uvx", "args": ["schema-guess-lite", "mcp"]}}}

What the free tier does and does not do

Free (this tool) Pay per use (Apify)
Records read first 50 up to 500,000, from files, links or datasets
JSON Schema, Pydantic, TypedDict yes yes
Optional and nullable fields, mixed types yes yes
Dates, emails, UUIDs as format no yes
Short lists of values as enum no yes
TypeScript and Zod no yes
Strict schema for AI structured output and tool calls no yes
Drift report against an old schema no yes

FAQ

Does it use AI? No. It reads the samples and follows fixed rules.

Does it send my data anywhere? No. It runs on your computer and never uses the internet.

Why is a field optional? It was missing from at least one record.

Why number and not integer? At least one value had decimals.

It only saw null for a field. What type is it? Open: Any in Pydantic, and no type in the schema. Add a sample with a real value.

Metadata

Release files for schema-guess-lite 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for schema-guess-lite 0.1.1
File Size Uploaded Provenance Actions
schema_guess_lite-0.1.1.tar.gz 17.5 kB With provenance Details for schema_guess_lite-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for schema-guess-lite 0.1.1
File Interpreter ABI Platform Actions
schema_guess_lite-0.1.1-py3-none-any.whl Python 3 none any Details for schema_guess_lite-0.1.1-py3-none-any.whl

Total release size: 31.9 kB

Release files / schema_guess_lite-0.1.1.tar.gz

Download URL schema_guess_lite-0.1.1.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2631003eb18f6d722a5230849026e480a3de19947861ddb13a83981badbe2b9c
BLAKE2b-256 checksum
How to use checksums
8df947bc8a27a6405782aa39f2e75f7bf817385711ed38fe2b1105502eb1c2e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / schema_guess_lite-0.1.1-py3-none-any.whl

Download URL schema_guess_lite-0.1.1-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56dd8d5b930e98d80fec63506584a7e386ce6cad02518b6c823ae47b94f724be
BLAKE2b-256 checksum
How to use checksums
d095213d3430e893056fa369e75507b1d57daa966af87710772561e130876e9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for schema-guess-lite 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for schema_guess_lite-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page