JSON to SQL Converter – Free, Online, Private
Build an INSERT statement from a JSON array of objects. Column names are the union of keys and nested values are stored as JSON text.
How to convert JSON to SQL
- Paste an array of objects, or one object for a single row.
- Set the table name if records is not the table you want.
- Copy the INSERT. Quote style matches a normal SQL string literal.
One statement, many rows
The converter gathers every key it sees and emits INSERT INTO table (columns) VALUES (...), (...). A key missing from a row is NULL in that row, not an error. Numbers are unquoted. Booleans are TRUE and FALSE. Strings use single quotes with embedded quotes doubled, which is the SQL standard, not backslash escaping. Objects and arrays are inserted as a single quoted JSON string so you do not lose them and you do not get a fake column per nested field. Rename the table in the box above the output. The default name is records.
What this is not
There is no CREATE TABLE, no types, and no UPSERT. The statement assumes the table exists and the column types accept the literals. An integer sample does not mean the column is INT; it only means the literal has no quotes. A string of digits stays quoted if the JSON type was string, so leading zeros survive. Identifiers that are not plain words are double-quoted. Reserved words you choose as a table name should be quoted by typing a name that needs quoting, or by renaming. The page does not connect to a database and cannot tell you that a column is missing.
Worked example
Two users become INSERT INTO records (id, name, active, city) with two value tuples. id is numeric, active is TRUE, names are quoted. Change the table to users before you copy if that is the real table. Add a tags array on one object and that row gains a column whose literal is a JSON array in quotes, while the other row has NULL. That is the rectangular compromise. For a normalized tags table you would split the JSON first. CSV to SQL on this site does the same INSERT shape starting from a spreadsheet.
Safety
The literals are escaped for a SQL string, but you should still review them before running the statement on a shared database. A value is data, not an identifier: it cannot close the statement and start another one through a quote, because quotes are doubled. Identifiers come only from keys and the table box. The JSON never leaves the browser, which is the reason to use a local page for a dump of real rows.
Frequently asked questions
Can I set the table name?
Yes. The table field defaults to records. Identifiers with spaces or symbols are double-quoted.
Are nested objects expanded?
No. A nested object or array becomes a JSON string in one column.
Which SQL dialect?
The literals are common SQL: TRUE, FALSE, NULL, and doubled single quotes. Quoting of identifiers uses double quotes.
Is the JSON uploaded?
No. The INSERT text is built locally.