Input
Ready
Lines: 0
Words: 0
Chars: 0
Size: 0 KB
Input statistics are available via the Stats button above this field.
Output
Lines: 0
Words: 0
Chars: 0
Size: 0 KB
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.