Convert JSON to SQL INSERT statements
Need to load a JSON export into a database? This tool turns a JSON array of objects into one SQL INSERT statement per row, ready to paste into psql, the MySQL client or SQL Server, with the escaping and identifier quoting handled for you.
How it works
The generator collects the column list from the union of all object keys, so a
key missing from some rows still gets a column. For each object it emits one
INSERT INTO table (cols) VALUES (...) line, choosing literals by type:
| JSON value | SQL literal |
|---|---|
| string | 'text' (single quotes doubled) |
| number | unquoted, e.g. 42 |
| boolean | TRUE / FALSE |
| null or missing key | NULL |
Picking a dialect changes how identifiers are quoted when quoting is enabled: PostgreSQL and SQL Server style differ from MySQL.
| Dialect | Identifier quoting |
|---|---|
| PostgreSQL | "name" |
| MySQL | `name` |
| SQL Server | [name] |
Example
This JSON:
[ { "id": 1, "name": "O'Hara", "active": true } ]
with table users generates:
INSERT INTO users (id, name, active) VALUES (1, 'O''Hara', TRUE);
The apostrophe in O'Hara was escaped by doubling it, the number stays
unquoted, and the boolean became TRUE.
Everything runs locally in your browser — nothing is uploaded, which makes it safe for confidential data and exports.