Convert a JSON array of objects into SQL INSERT statements — MySQL, PostgreSQL/ANSI or SQL Server quoting, multi-row or per-row, nested objects flattened into columns. Built for fixtures and seed data.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
Seed data without the typing
Fixtures, seeds and one-off imports all start the same way: a JSON array that needs to become INSERT statements. Enter the table name, pick the dialect, and every row becomes a correctly quoted tuple — single quotes doubled (O'Brien → O''Brien), null as NULL, booleans per dialect, identifiers in backticks, [brackets] or “quotes” as appropriate. Nested objects flatten into underscore columns.
Worked example
INSERT INTO `cafes` (`name`, `city`, `rating`, `open`) VALUES
('O''Brien Cafe', 'Pune', 4.5, TRUE),
('Chai Point', 'Delhi', 4.1, FALSE),
('Brew & Co', 'Mumbai', NULL, TRUE);When to use it
- Database seeders and test fixtures from captured API data.
- One-off imports reviewed before running.
- Reproducing a bug locally with production-shaped rows.
Limitations to know — read this one
- Generated SQL strings are for fixtures you review, not application code. Code handling untrusted input must use parameterized queries — that is the actual defense against SQL injection, and no literal generator replaces it. The tool repeats this on every run.
- Column types are implied by the literals; your table schema still decides what is accepted.
- Multi-row INSERTs are fast and atomic; per-row statements survive individual failures — both are options.
Common errors and fixes
- Wrong quoting style — switch the dialect; identifier quoting is the visible difference between MySQL, ANSI and SQL Server.
- Nested data — flattening on gives user_name columns; flattening off stores nested objects as JSON strings in one column.
How to use the JSON to SQL Insert Converter
- Paste a JSON array of objects — one object per row.
- Enter the table name and pick your SQL dialect.
- Choose one multi-row INSERT or one statement per row.
- Click "Generate SQL" and use the output for fixtures, seeds or one-off imports.
Frequently asked questions
How are values escaped?
Single quotes double (O'Brien → O''Brien), null becomes NULL, booleans become TRUE/FALSE (or 1/0 for SQL Server), and identifiers are quoted per dialect — backticks for MySQL, [brackets] for SQL Server, "quotes" for PostgreSQL/ANSI.
Is this safe against SQL injection?
The escaping is correct for the generated literals — but the honest answer is that generated SQL strings are for FIXTURES and seeds you review before running. In application code handling untrusted input, parameterized queries remain the only right answer; the tool says so on every run.
How do nested objects map to columns?
With flattening on, user.name becomes a user_name column — matching how imports usually model nested data. Turn it off to store nested objects as JSON strings in a single column instead.
Multi-row or per-row INSERTs?
One multi-row INSERT is faster and atomic — ideal for seeds. Per-row statements let a partial import survive one bad row and produce clearer error lines in some clients.