JSON to CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQLite or SQL Server
Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 17 Oct 2026.Paste a JSON array or a CSV and get a CREATE TABLE with inferred column types plus INSERT statements for PostgreSQL, MySQL, SQLite or SQL Server. Quotes, backslashes and reserved column names are escaped the way each database needs, and rows are batched 100 per statement by default.
Paste a JSON array of objects, or a CSV with a header row, or press Try an example.
Choose the database: PostgreSQL, MySQL, SQLite or SQL Server, and type the table name.
Read the CREATE TABLE with the inferred column types and the INSERT statements below it.
Press Copy, or Download the .sql file, and run it in your database.
Seeding a test database, loading an API response for analysis or moving a spreadsheet into a table all start with the same chore: writing a CREATE TABLE and a pile of INSERT statements. This page writes both from the data itself.
Column types are worked out from the values.
| Values in the column | PostgreSQL | MySQL | SQLite | SQL Server |
|---|---|---|---|---|
| Whole numbers | INTEGER or BIGINT | INTEGER or BIGINT | INTEGER | INTEGER or BIGINT |
| Decimals | NUMERIC | DOUBLE | REAL | FLOAT |
| true / false | BOOLEAN | BOOLEAN | BOOLEAN | BIT |
| 2026-10-17 | DATE | DATE | TEXT | DATE |
| Objects or arrays | JSONB | JSON | TEXT | NVARCHAR(MAX) |
| Text | TEXT | VARCHAR(255) or TEXT | TEXT | NVARCHAR(255) or larger |
A column with no empty values gets NOT NULL, and an integer column named id with unique values becomes the PRIMARY KEY. A column mixing numbers and text is stored as text, and the page says so.
Escaping that differs by database. A single quote is doubled everywhere. MySQL also treats a backslash as an escape character, so backslashes are doubled for MySQL and only there. SQL Server gets an N prefix on text with non-ASCII characters so Hindi or emoji survive. Reserved or mixed-case column names are quoted with double quotes, backticks or brackets as each database expects.
Batching. Rows are grouped 100 per INSERT by default; set 1 for one statement per row. SQL Server allows at most 1,000 rows in one VALUES list, so larger batches are capped there.
How it was checked. The output for 15 test cases, covering quotes, backslashes, emoji, reserved names, nested JSON, nulls, big integers and timestamps, was run in PostgreSQL 17 and SQLite 3.35, and the rows each engine read back equal the input. Nothing you paste leaves your browser. To go the other way, from INSERT statements back to JSON, use SQL to JSON.
Paste the JSON array here, choose your database and copy the script: a CREATE TABLE with a column per key, then INSERT statements with every value escaped. Run the script in psql, the MySQL client, sqlite3 or SQL Server Management Studio. Nested objects and arrays go into a JSON or text column.
Each column is typed from all of its values: whole numbers become INTEGER, or BIGINT beyond 2,147,483,647; decimals become NUMERIC, DOUBLE, REAL or FLOAT; true and false become BOOLEAN or BIT; YYYY-MM-DD strings become DATE; objects become JSON. Anything mixed becomes text, and the page tells you which columns.
MySQL reads a backslash inside a string literal as the start of an escape such as \n, unless the server runs with NO_BACKSLASH_ESCAPES. Doubling every backslash keeps a path like C:\temp intact. PostgreSQL, SQLite and SQL Server read backslashes literally, so their output leaves them as they are.
SQL Server allows 1,000 rows in one VALUES list and returns error 10738 beyond that. PostgreSQL, MySQL and SQLite have no fixed row limit, but very long statements hit packet or memory limits, so 100 to 1,000 rows per statement is a safe choice. Batches here default to 100 rows.
Yes. Paste CSV or TSV with a header row instead of JSON and the delimiter is detected. Empty cells become NULL, numbers and true or false get typed columns, and values with leading zeros, such as ZIP code 00501, stay text so the zeros are kept.
No. Reading the JSON or CSV, working out the column types and writing the SQL all happen in your browser, and nothing is sent to a server or stored. The file you download is created on your device as well.
Rates and rules change; check the source before you rely on a figure.
Still stuck? Ask about JSON to SQL Converter and anybody who knows can answer. No account needed.
Same job, other tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · JSON to YAML – Turn JSON into clean, readable YAML for configs · Query String Parser – Split a URL query string into a table of decoded parameters.