developer · Browser tool
Data Schema Generator
Paste sample JSON or CSV. You get a JSON Schema, a TypeScript interface, a SQL CREATE TABLE and a Zod validator built from the same inferred shape.
Sample data
JSON Schema
TypeScript interface
SQL CREATE TABLE
Only top-level fields become columns. A nested object or an array is written as a JSON column, because a relational table cannot hold it any other way without a second table.
Zod validator
How the shape is worked out
Every record you paste is walked key by key. A key that appears in all records is required; a key missing from even one record is marked optional, which is the part you cannot get from a single sample. A key that is present but sometimes null is nullable instead — in TypeScript that is the difference between role?: string and role: string | null, and under strictNullChecks the two behave differently.
What the output describes
If you paste an array, the generated schema, interface, table and validator all describe one record, not the array. That is almost always what you want to put in a codebase. Wrap the JSON Schema in {"type":"array","items":…} yourself if you need to validate the whole list.
String formats
A string field is given a JSON Schema format only when every non-null value in the sample matches the same pattern: ISO date, ISO date-time, email address, UUID or an absolute URI. One value that does not fit removes the format from the whole field, because a format that holds for four rows out of five is a validation failure waiting to happen.
CSV is a weaker source
CSV carries no types. Columns are read as integer, number, boolean or string by testing every cell, and a single cell that does not fit drops the column back to string. An empty cell becomes null, so a column with blanks comes out nullable — but CSV genuinely cannot tell an empty string apart from a missing value, so that call is a guess. Quoted fields, embedded commas and newlines inside quotes are handled, and the delimiter is detected from the header line between comma, semicolon and tab.
The honest limit
Inference only ever sees the sample you gave it. If a field is an integer in all forty rows you pasted but a decimal in production, the schema will say integer and your validator will reject real data later. Treat the output as a first draft you read through, not as a contract. Enum values, string length limits, foreign keys and numeric precision are all things the data cannot tell you about — the SQL column widths in particular are conventional defaults, not measurements.