Schema Inferrer

Paste a CSV or JSON sample and infer both a JSON Schema and a SQL CREATE TABLE. Types, nullability, and formats are detected from the data — pick a SQL dialect and JSON Schema draft, all in your browser.

Try:
Inferred schema

Infer a JSON Schema and a SQL CREATE TABLE from sample data

Paste a sample dataset — CSV/delimited text with a header row, or JSON (one record object or an array of record objects) — and this tool infers a type and nullability for every column, then emits two schema artifacts at once:

It reads schemas only — no INSERT rows — so the output is exactly the structure definition you paste into a validator, a migration, or an ORM. Everything runs locally in your browser.

Worked example

Input (JSON records):

[{"id":1,"email":"[email protected]","active":true},
 {"id":2,"email":"[email protected]","active":false}]

With table users and primary key id, the both output is:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "users",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "integer"
      },
      "email": {
        "type": "string",
        "format": "email"
      },
      "active": {
        "type": "boolean"
      }
    },
    "required": [
      "id",
      "email",
      "active"
    ],
    "additionalProperties": false
  }
}

CREATE TABLE "users" (
  "id" INTEGER NOT NULL,
  "email" TEXT NOT NULL,
  "active" BOOLEAN NOT NULL,
  PRIMARY KEY ("id")
);

How inference works

Limits and edge cases

What is the difference between this and a CSV-to-SQL or JSON-to-JSON-Schema tool?

Those tools produce a single artifact. A CSV-to-SQL converter emits CREATE TABLE plus INSERT rows for loading data; a JSON-to-JSON-Schema tool emits only a JSON Schema. Schema Inferrer runs one type-inference pass over your sample and returns both a JSON Schema and a CREATE TABLE (schemas only, no INSERT rows), so you get a validation schema and a database definition side by side.

Which SQL dialects and JSON Schema drafts are supported?

SQL: MySQL, PostgreSQL, SQLite, SQL Server (mssql), and ANSI. The dialect sets identifier quoting (backticks, double quotes, or brackets) and column types — for example a float becomes DOUBLE / DOUBLE PRECISION / REAL / FLOAT, and a datetime becomes TIMESTAMP / DATETIME / DATETIME2. JSON Schema: Draft 2020-12 (default) or Draft-07, which changes the $schema URL and whether the uuid string format is emitted.

How are column types decided?

A column takes the most specific type that fits all of its non-empty values: boolean (true/false/yes/no/t/f), integer, float, date (YYYY-MM-DD, MM/DD/YYYY, and slash/dash variants), datetime (YYYY-MM-DD HH:MM:SS or ISO 8601 with T/Z), otherwise text. A single value that does not fit demotes the whole column — e.g. one non-numeric cell keeps the column as text. Empty cells and JSON nulls are ignored for type inference but still count toward nullability.

Does my data leave the browser?

No. Inference runs entirely in WebAssembly on this page — your sample dataset is never uploaded to a server. You can also run it from the command line with the gizza CLI, or from chat.

Can I get just the JSON Schema or just the SQL?

Yes. Set Output to JSON Schema only or SQL CREATE TABLE only; the default both returns the JSON Schema first, then the CREATE TABLE.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool schema-inferrer "id,email,score,active,joined
1,[email protected],9.5,true,2024-01-02
2,[email protected],7,false,2024-02-10"

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/schema-inferrer/?data=id%2Cemail%2Cscore%2Cactive%2Cjoined%0A1%2Ca%40example.com%2C9.5%2Ctrue%2C2024-01-02%0A2%2Cb%40example.com%2C7%2Cfalse%2C2024-02-10&format=auto&delimiter=auto&has_header=true&output=both&table=users&dialect=postgres&draft=2020-12&primary_key=id&not_null=true&detect_formats=true

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.