Free Online JSON to SQL (INSERT Statements) Converter

Paste a JSON array of objects below to generate ready-to-run SQL INSERT statements - handy for seeding a test database or migrating a small dataset.

Input Ready

Input statistics are available via the Stats button above this field.

Output

Output statistics are available via the Stats button above this field.

Results are provided for informational purposes only and may contain errors. Please verify important information independently. Use of this tool is at your own risk.

What the JSON to SQL Converter does

The JSON to SQL Converter turns an array of JSON objects into SQL INSERT statements, one statement per object. Keys become column names, quoted with backticks, and values are written as SQL literals.

Numbers are written as is, true and false become 1 and 0, and text is wrapped in single quotes with any apostrophe doubled (O'Brien becomes 'O''Brien'). Nested objects are flattened into underscore-joined column names, as in the JSON to CSV Converter. The table name is always converted_data, so replace it with your own table name before running the statements.

When to use it

  • Seeding a development or test database from a JSON fixture.
  • Moving a small data export from an API into MySQL or MariaDB.
  • Writing a migration or a support script where you need a few rows as SQL.

Worked example

Input

[
  {"id": 1, "name": "O'Brien", "active": true},
  {"id": 2, "name": "Ana", "active": false}
]

Output

INSERT INTO converted_data (`id`, `name`, `active`) VALUES (1, 'O''Brien', 1);
INSERT INTO converted_data (`id`, `name`, `active`) VALUES (2, 'Ana', 0);

Common questions about the JSON to SQL Converter

Which databases accept the output?

The backtick-quoted column names are MySQL and MariaDB syntax. For PostgreSQL or SQL Server, replace the backticks with double quotes or square brackets.

Does it create the table?

No. It writes INSERT statements only. The table must already exist with matching columns.

Can I turn INSERT statements back into JSON?

Yes, with the SQL (INSERT Statements) to JSON Converter. The SQL Formatter makes long statements easier to read.

Frequently Asked Questions

Which SQL dialect does it generate?

It generates standard ANSI SQL INSERT syntax that runs unmodified on MySQL, PostgreSQL, and SQLite. You supply the table name/schema separately.

Does it create the table for me?

No - it generates INSERT statements assuming the table already exists with matching column names. Use the "Format SQL" button to tidy the output afterward.

Is this tool free?

Yes, it's free to use. No signup, no email required. Get results on this page.

How do I get my result?

Use the tool on this page. Your result appears here; no email delivery is required.