What This Tool Does
This tool converts a JSON array of objects into a single, ready-to-run SQL INSERT statement. Paste an array like [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}], set a table name, and it generates a multi-row INSERT INTO statement covering every object in the array.
Use the Table name field above the editors to set the target table. If you leave it blank, the tool falls back to my_table. Column names are collected as the union of keys found across all objects in the array, so if some objects are missing a field, that field becomes NULL for those rows.
Identifiers (table and column names) are wrapped in backticks (`), which is MySQL and MariaDB syntax. Values are converted based on type: null and undefined become NULL, numbers and booleans are written unquoted, and strings and objects are single-quoted with backslashes and single quotes escaped so the resulting SQL is syntactically valid.
How to Use It
- Paste a JSON array of objects into the Input box. Each object should represent one row to insert.
- Set the Table name field to the name of your destination table (defaults to
my_tableif left blank). - Click Run to generate the SQL statement.
- Copy the result from the Output box.
- Review the generated statement, confirm the table structure already exists in your database, and execute it with your SQL client or migration tool.
Worked Example
Table name: customers
Input JSON:
[
{ "id": 1, "name": "O'Brien", "active": true, "notes": null },
{ "id": 2, "name": "Ana \"Lee\"", "active": false, "notes": "VIP" },
{ "id": 3, "name": "Sam\\Corp", "active": true, "notes": "Path: C:\\data" }
]
Generated SQL:
INSERT INTO `customers` (`id`, `name`, `active`, `notes`) VALUES
(1, 'O''Brien', true, NULL),
(2, 'Ana "Lee"', false, 'VIP'),
(3, 'Sam\\Corp', true, 'Path: C:\\data');
Notice how the apostrophe in O'Brien becomes a doubled single quote (''), the backslash in Sam\Corp is doubled to \\, and the third row's missing-value cases show how a JSON null becomes SQL NULL while booleans (true/false) are written unquoted.
Common Use Cases
- Seeding a database from an API export. Pull a JSON response from a REST API and turn it directly into rows for a staging or development database.
- Bulk-loading test data. Generate fixture data in JSON, then convert it into INSERT statements for automated test setups.
- Migrating JSON data dumps into a relational database. When moving data out of a document store, log file, or NoSQL export into MySQL or MariaDB, this tool skips writing one-off scripts.
- Quick manual data entry. Sketch out a handful of records as JSON (which is easier to edit than raw SQL) and convert them when you are ready to insert.
SQL Dialect Notes
This generator produces MySQL/MariaDB-style SQL: identifiers are wrapped in backticks (`table`, `column`), which is the quoting convention those databases use. This is not standard ANSI SQL.
PostgreSQL uses double quotes for identifiers instead of backticks ("table", "column"). If you are targeting Postgres, replace the backticks with double quotes before running the statement, or drop the quoting altogether if your table and column names are lowercase and contain no special characters or reserved words. SQL Server uses square brackets ([table]) by convention, which also requires a manual swap.
Frequently Asked Questions
What table name does it use by default?
If you leave the Table name field blank, the tool defaults to my_table.
Does it create the table (CREATE TABLE)?
No, it only generates INSERT statements. The table structure needs to already exist in your database before you run the generated SQL.
Is my data uploaded anywhere?
No. Conversion runs entirely in your browser via JavaScript — your JSON never leaves your machine.
Will this work with PostgreSQL or SQL Server?
The generated SQL uses MySQL/MariaDB-style backtick-quoted identifiers. For PostgreSQL, swap the backticks for double quotes; for SQL Server, swap them for square brackets.
What if my objects have different sets of keys?
The tool builds its column list from the union of all keys across every object. Rows missing a given key will get NULL for that column.
Related Tools & Guides
- Browse all JSON tools
- Turning JSON API Responses into SQL INSERT Statements — a deeper guide on escaping, nested data, and identifier quoting.
- JSON to CSV Converter — for flattening JSON into spreadsheet-friendly rows instead of SQL.