JSON to SQL CREATE TABLE
Turn a JSON object or array of objects into a SQL CREATE TABLE statement.
JSON to SQL CREATE TABLE
Paste a JSON object, or an array of JSON objects, and this tool builds a ready-to-run SQL CREATE TABLE statement from it — point it at a sample API response or an exported record and get a starting schema instead of typing every column by hand.
Column types are inferred from the actual values: whole numbers become INTEGER, numbers with a fractional part become DECIMAL, true/false becomes BOOLEAN, strings shaped like 2024-01-15 or 2024-01-15T10:30:00Z become DATE or TIMESTAMP, and everything else becomes VARCHAR with an estimated length, or TEXT past 255 characters. A field marked NOT NULL is one that is present, and never null, in every record pasted; a field named id becomes the PRIMARY KEY. Pick a dialect — ANSI SQL, MySQL, PostgreSQL, SQLite or SQL Server — to match the small differences in type names. Nested objects can be flattened into prefixed columns (address.city becomes address_city) or kept as a single JSON column, and "Convert names to snake_case" turns camelCase JSON keys into conventional SQL column names.
With more than one record, turning on "Add INSERT statements" appends one INSERT per record beneath the CREATE TABLE, using the same inferred columns — handy for seeding a test database from a JSON fixture. Inference always looks across every record supplied, not just the first, so a field only sometimes present is correctly left nullable rather than guessed wrong.
Everything runs in your browser. The JSON you paste, and the schema generated from it, are never uploaded anywhere — that matters when the sample data comes from a production export. Copy the result, download it as a .txt file, or send the output back into the input to keep refining the schema.