JSON in, SQL out: one store order
Here is a two-row order dump the Sample button loads. Left side is the source. Right side is what Bulk INSERT mode produces for a table named orders.
[{"id": 1042,"sku": "MUG-TEAL","qty": 2,"paid": true,"note": null},{"id": 1043,"sku": "TOTE-NAVY","qty": 1,"paid": false,"note": "gift wrap"}]INSERT INTO orders (id, sku, qty, paid, note) VALUES
(1042, 'MUG-TEAL', 2, 1, NULL),(1043, 'TOTE-NAVY', 1, 0, 'gift wrap');Booleans become 1 / 0. Null stays NULL. Strings get quote-escaped. Integers stay bare numbers.
What happens under the hood
Conversion runs entirely in your browser tab. Nothing uploads.
- Repair, then parse. A repair pass fixes common JSON issues (trailing commas, missing quotes) before
JSON.parseruns. Broken input shows the error under the left panel instead of silent failure. - Collect columns. For an array, every key across every object becomes a column. A missing key on one row inserts as
NULL. - Infer types for CREATE TABLE. Numbers become
INTorDECIMAL, booleans becomeBOOLEAN, short strings becomeVARCHAR(255), longer ones becomeTEXT. Nested objects and arrays stringify intoTEXT. - Emit SQL for the mode you picked. One INSERT per row, a CREATE TABLE plus inserts, or a single multi-row INSERT.
Need the JSON cleaned before conversion? Run JSON Fixer or JSON Beautifier first, then paste the result here.
Where this converter stops
No foreign keys, no indexes, no primary key hints. The CREATE TABLE output is a starting scaffold, not a production schema.
- Nested objects and arrays land as escaped JSON text inside one column. There is no automatic JOIN or child-table split.
- Dialect quirks (Postgres
TRUE/FALSE, SQL Server bracket identifiers, SQLite affinity) stay out of scope. Output targets common MySQL-style backticks and1/0booleans. - Multi-megabyte payloads slow the Ace editors long before the converter itself fails. Split large dumps.
- Date-looking strings stay strings. No automatic
DATEorTIMESTAMPcasting.
Prefer a spreadsheet intermediate? JSON to CSV keeps columns flat without inventing SQL types. Prefer YAML configs over table rows? Use JSON to YAML instead.
Quick checks before you run the SQL
- Rename the table to match your real schema. Default sample uses
orders. - Scan CREATE TABLE for VARCHAR vs TEXT on long notes or descriptions.
- Prefer Bulk INSERT once you cross a few hundred rows.
- Wrap the paste in a transaction in your client if a mid-batch failure would leave half the rows behind.
