Turn JSON records into INSERT statements with values escaped for your dialect, or into parameterised statements with the values kept separate.
Waiting for records
Paste a JSON array of objects. Nothing is executed and no database is contacted.
Nothing generated yet
Paste a JSON array of objects on the left.
SQL INSERT Generator runs entirely on your device — nothing is uploaded, and no database is contacted.
You’re on the Free plan. Compare plans
Two forms come out of this, and the difference between them is the difference between a seed file and a vulnerability. Literal values are right for a migration you run once and read in a diff. Placeholders with the values kept separate are right for anything in application code, because the database never parses a value as SQL.
Escaping a value correctly makes a literal safe to write. It does not make string-building safe as a habit, which is why the parameterised form is offered beside it rather than buried — the next person writes the concatenation without the escaping.
The escaping is dialect-specific, and that is not a detail. A quote is doubled everywhere, but MySQL also treats a backslash as an escape character where PostgreSQL and SQLite do not, and SQL Server needs an `N` prefix to carry anything outside its default code page. A generator that escapes once for all of them produces output that is wrong in at least one.
A `null` in JSON becomes a SQL NULL rather than the string "null", and a key absent from one record also becomes NULL rather than a default — which is why the column list is the union of every record's keys rather than the first record's.
`ON CONFLICT` is offered in all three forms, with the dialect's own spelling: PostgreSQL and SQLite say `ON CONFLICT`, MySQL says `ON DUPLICATE KEY UPDATE`, and SQL Server needs `MERGE`, which is a different statement with its own hazards.
The values are escaped correctly for the dialect, so the statement itself is sound. It is safe to run and it is not a pattern to copy into code — in application code the values should be parameters, because escaping relies on someone remembering and parameters do not.
Escaping makes one value safe to embed in a query string. Parameterising sends the query and the values separately, so the database never parses a value as SQL at all. The second cannot be forgotten halfway through a refactor.
Because MySQL treats a backslash as an escape character inside string literals by default, where PostgreSQL and SQLite do not. A string containing a backslash has to be written differently, and ignoring that corrupts data rather than failing loudly.
A single multi-row INSERT is far faster — one round trip, one transaction, one parse. One statement per row is easier to read in a diff and easier to re-run after a partial failure. Both are offered because both are the right answer sometimes.
Up to five thousand. Beyond that a bulk loader — `COPY` in PostgreSQL, `LOAD DATA` in MySQL — will be dramatically faster than any INSERT, and the tool says so rather than generating something unusable.