JSON to SQL INSERT
Paste a JSON array and get ready-to-run INSERT statements. Column names are derived from the keys, values are escaped for the dialect you pick, and nested objects either flatten into dotted columns or stay as one JSON column. Nothing leaves your browser.
How to convert JSON to SQL INSERT statements
- Paste a JSON array of objects, or drop a
.jsonfile onto the input pane. - Pick your Dialect — it decides identifier quoting (
"col"vs`col`) and how booleans are written. - Set the Table name and choose how column names are cased. snake_case turns
userNameintouser_name. - Raise Rows per statement to batch many rows into one multi-VALUES insert — far faster than one statement per row.
- Tick Add upsert clause if the rows may already exist. Postgres and SQLite get
ON CONFLICT … DO UPDATE; MySQL getsON DUPLICATE KEY UPDATE. - Copy the SQL, or download it as a
.sqlfile you can pipe intopsql/mysql/sqlite3.
How values are escaped
- Strings — single quotes are doubled (
O'Brien→'O''Brien'), the SQL-standard escape that works on every dialect. - Numbers — written bare.
NaNandInfinitycannot exist in JSON, so nothing to handle there. - Booleans —
TRUE/FALSEon Postgres,1/0on MySQL and SQLite, which have no native boolean type. - null and missing keys — both become
NULL. A key present in one record but absent in another still gets a column; the rows that lack it insertNULL. - Objects and arrays — serialised back to JSON text and inserted as a string literal. On Postgres you will usually want the target column to be
jsonb.
Getting the table first
You need a table before you can insert into it. JSON → CREATE TABLE reads
the same input and infers column types from the actual values — integers, doubles, booleans, timestamps,
and jsonb for nested data. Run that first, then come back here for the rows.
Privacy
Nothing is uploaded. The conversion runs in this tab using your own browser's JavaScript engine — no server sees your data, and the page keeps working with the network disconnected.
FAQ
Why is my array column a single JSON string?
Because that is almost always what you want in a relational table. Set Arrays to Comma-joined for a plain text list, or One column per index if you genuinely want tags_0, tags_1 columns — though that makes the column set depend on the longest array in your data.
Can it handle a JSON object instead of an array?
Yes — a single object becomes a single-row insert. An object wrapping exactly one array (the common {"items": […]} API envelope) is unwrapped automatically.
Are the statements safe to run against production?
Read them first. The tool escapes string literals correctly, but it cannot know about your constraints, triggers, or column types. Run inside a transaction so you can roll back.
Does it work offline?
Yes. Everything is plain JavaScript in this page — no library downloads, no network calls.