WoluTools

schema-gen · Generator

Generate a JSON Schema from sample JSON or CSV

Paste sample JSON or CSV and get a matching JSON Schema, TypeScript interface, Zod validator or SQL CREATE TABLE, with types and required fields filled in.

Free toolNo account · no job limitFree, unlimitedRuns in your browser once the page has loaded.
  • JSON and CSV input
  • JSON Schema, TypeScript, SQL, Zod output
Prepared result preview · fictional sample dataSample JSON → JSON Schema + TypeScript
Source · JSON array (3 records)
[
  {"id": 1, "name": "Alice", "email": "alice@example.com",
   "age": 32, "active": true, "role": null},
  {"id": 2, "name": "Bob", "email": "bob@example.com",
   "age": 28, "active": true, "role": "admin"},
  {"id": 3, "name": "Carol", "email": null,
   "age": 45, "active": false, "role": "editor"}
]
Generated · JSON Schema + TypeScript
// JSON Schema (2020-12)
{
  "type": "object",
  "required": ["id","name","age","active"],
  "properties": {
    "id":     {"type": "integer"},
    "name":   {"type": "string"},
    "email":  {"type": ["string","null"]},
    "age":    {"type": "integer"},
    "active": {"type": "boolean"},
    "role":   {"type": ["string","null"]}
  }
}

// TypeScript
interface User {
  id: number;
  name: string;
  email: string | null;
  age: number;
  active: boolean;
  role: string | null;
}
BringSample JSON or CSV data
GetJSON Schema, TypeScript, SQL, or Zod
CostFree · runs in your browser

One clear job, from sample data to schema

  1. 1

    Paste your sample data

    Drop in a JSON array, a single JSON object, or CSV with a header row. The more rows you provide, the better the type inference — nullable fields and optional properties are detected by comparing across records.

  2. 2

    Choose output formats

    Select one or more targets: JSON Schema (draft 2020-12 or draft-07), TypeScript interface, SQL CREATE TABLE (PostgreSQL, MySQL, or SQLite), or Zod validator. All outputs are generated from the same inferred schema.

  3. 3

    Copy and use

    Copy the generated schema, interface, or DDL directly into your project. Each output is formatted and ready to paste — no cleanup needed. Adjust field names or types if your sample data did not cover every edge case.

Generate a schema from the data you already have

Paste JSON or CSV samples

You paste a JSON array, a single JSON object, or CSV with a header row. The generator compares every record, so more rows give better results. A field that is null in any row becomes nullable. A field missing from some rows is left out of the required list. Paste the messiest sample you have, not the cleanest, because three tidy rows can hide the gaps that twenty real ones show. It runs in your browser with no job limit.

Four outputs from one inferred schema

You can pick JSON Schema, a TypeScript interface, a SQL CREATE TABLE statement or a Zod validator. All four come from the same inferred structure. Nested objects in TypeScript become separate named interfaces, such as a User that references an Address. For CSV, column types are inferred as strings, integers, floats, booleans, dates or nullable. Check the required list and the nullable fields against what you know about your data before you paste the output into a project.

Draft, dialect and SQL type choices

JSON Schema output defaults to draft 2020-12, and you can switch to draft-07 if your validator needs it. SQL defaults to PostgreSQL, with MySQL and SQLite as options. Strings under 255 characters map to VARCHAR(255), longer ones to TEXT, integers to INTEGER and decimals to NUMERIC. Where a choice was unclear, the SQL output carries a comment so you know what to look at. Column lengths and precision for your real data stay your decision.

Questions before you run it

Which JSON Schema draft does the output use?

The default output uses JSON Schema draft 2020-12. You can switch to draft-07 if your tooling requires it. The main differences are in vocabulary keywords and how conditional schemas work — for typical data validation, both drafts produce equivalent results.

How does the tool handle nullable fields?

If a field is null in any sample row, it is marked as nullable in the schema. If a field is missing entirely from some rows, it is excluded from the required array. A nullable field must be present but can be null; an optional field can be absent entirely.

Can I generate schemas from CSV data?

Yes. Paste CSV with a header row, and the tool infers column types from the data values. It distinguishes between strings, integers, floats, booleans, dates, and nullable columns. The output includes JSON Schema, TypeScript, SQL CREATE TABLE, and Zod — same as for JSON input.

How are nested objects handled in TypeScript output?

Nested objects become separate named interfaces. A user object with an address field generates both a User interface and an Address interface, with User referencing Address by type. Array items get their own interface when they contain objects.

What SQL dialect does the CREATE TABLE use?

The default output is PostgreSQL-compatible. You can switch to MySQL or SQLite syntax. The main differences are type names and auto-increment syntax. The tool maps JSON types to appropriate SQL types with sensible defaults for string length and numeric precision.