JSON to SQL
Turn a JSON array of objects into ready-to-run INSERT statements for MySQL, PostgreSQL or SQLite.
Your data stays on your device
Input — JSON
- characters
- 0
- lines
- 0
- size
- 0 B
Output — SQL
- characters
- 0
- lines
- 0
- size
- 0 B
Options
About this tool
Seeding a table from a JSON export usually means writing INSERT statements by hand. This tool builds them for you: it takes the union of keys across your objects as the column list and emits one row per object, with values quoted and escaped correctly for the dialect you choose.
It only produces SQL text — it never connects to a database or runs anything. Strings are escaped by doubling single quotes, nulls become NULL, booleans follow each dialect, and nested objects or arrays are stored as JSON strings.
How to use this tool
- Paste a JSON array of objects, or a single object.
- Enter the target table name and pick MySQL, PostgreSQL or SQLite.
- Choose one combined INSERT or one statement per row.
- Press Generate SQL, then copy or download the statements.
Key features
- MySQL, PostgreSQL and SQLite dialects
- Correct identifier quoting per dialect
- Single multi-row INSERT or one statement per row
- Single quotes in strings escaped safely
- Column list built from the union of all keys
Example
Input — JSON
[{"id":1,"name":"Ada"},{"id":2,"name":"Alan"}]Output — SQL
INSERT INTO my_table (`id`, `name`) VALUES
(1, 'Ada'),
(2, 'Alan');Good to know
- It generates INSERT statements only. Table creation, types and constraints are up to you.
- Values are formatted as literals; it does not use parameterised queries, so review the output before running it on real data.
Frequently asked questions
Does this run against my database?
No. It produces SQL text only. Nothing connects to a database and nothing is executed.
How are nested objects handled?
Nested objects and arrays are stored as JSON strings in the column, since a single column cannot hold a structured value directly.
What if objects have different keys?
The column list is the union of every key seen. Rows missing a key get NULL for that column.
Your data stays on your device
Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.