JSON to SQL Insert
Turn a JSON array of objects into INSERT statements. Columns are the union of the keys, in first-seen order.
What JSON to INSERT does
Each object is one row and the column list is the union of the keys across every object, in the order they first appear, so a key that only one row carries still gets its own column instead of being silently dropped. true and false become TRUE and FALSE, null becomes NULL, and a nested object or array is written as its JSON text — SQL has no row value here, and flattening it would invent a schema you did not ask for.
How to use it
JSON to SQL Insert: paste the JSON into the box above, set Table name (default "data"), and press Run to get the SQL below.
Worked example
Input:
[
{
"id": 1,
"name": "Ada",
"role": "admin"
},
{
"id": 2,
"name": "O'Brien",
"role": "author"
},
{
"id": 3,
"name": "Grace",
"role": null
}
]
Output:
INSERT INTO data (id, name, role) VALUES
(1, 'Ada', 'admin'),
(2, 'O''Brien', 'author'),
(3, 'Grace', NULL);
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads JSON and returns SQL; reloading the page discards both.
Each object is one row and the column list is the union of the keys across every object, in the order they first appear, so a key that only one row carries still gets its own column instead of being silently dropped. true and false become TRUE and FALSE, null becomes NULL, and a nested object or array is written as its JSON text — SQL has no row value here, and flattening it would invent a schema you did not ask for.
Turn a JSON array of objects into INSERT statements. Columns are the union of the keys, in first-seen order.
How to use it
JSON to SQL Insert: paste the JSON into the box above, set Table name (default "data"), and press Run to get the SQL below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads JSON and returns SQL; reloading the page discards both.
What to Expect
Best for
- Converting JSON to SQL when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
[ { "id": 1, "name": "Ada", "role": "admin" }, { "id": 2, "name": "O'Brien", "role": "author" }, { "id": 3, "name": "Grace", "role": null } ]
Sample output
INSERT INTO data (id, name, role) VALUES (1, 'Ada', 'admin'), (2, 'O''Brien', 'author'), (3, 'Grace', NULL);
Frequently asked questions
How do I use the json to sql insert?
JSON to SQL Insert: paste the JSON into the box above, set Table name (default "data"), and press Run to get the SQL below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.