JSON to SQL Converter

An API dump sits in a file. Your table expects rows. Paste the JSON, name the table, pick single INSERT or bulk, copy the SQL.

JSON input

Ready
Paste an object or an array of objects

SQL output

Waiting
SQL appears as you type

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.

JSON
[{"id": 1042,"sku": "MUG-TEAL","qty": 2,"paid": true,"note": null},{"id": 1043,"sku": "TOTE-NAVY","qty": 1,"paid": false,"note": "gift wrap"}]
SQL (bulk)
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.

  1. Repair, then parse. A repair pass fixes common JSON issues (trailing commas, missing quotes) before JSON.parse runs. Broken input shows the error under the left panel instead of silent failure.
  2. Collect columns. For an array, every key across every object becomes a column. A missing key on one row inserts as NULL.
  3. Infer types for CREATE TABLE. Numbers become INT or DECIMAL, booleans become BOOLEAN, short strings become VARCHAR(255), longer ones become TEXT. Nested objects and arrays stringify into TEXT.
  4. 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.

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.

JSON to SQL questions people hit mid-import

Type guessing, nesting, and when to switch modes.

Does my JSON leave the browser?

No. Parsing, type inference, and SQL generation all run in JavaScript on your device. The page never posts the payload to a server.

What JSON shapes work?

A single object, or an array of objects. A bare array of strings or numbers has no column names, so the converter refuses them. Wrap scalars in objects first.

When should I pick Bulk INSERT over one INSERT per row?

Use one INSERT per row when you need to edit or delete a single statement by hand. Switch to Bulk once the row count climbs past a few hundred. One multi-row statement cuts parse overhead on the database side.

Why did a nested field become TEXT?

SQL columns hold scalar values. An object or array has no single SQL type on this page, so the converter stringifies the subtree into a TEXT column. Flatten keys yourself if you need separate columns.

Are the CREATE TABLE types final?

No. Types come from the first sample value per column. Mixed types across rows, UUID strings, and ISO dates often need a manual edit before you ship the schema to production.

How do I finish after copying the SQL?

Paste into your SQL client or migration file, review identifiers and types, then run inside a transaction. After hand-edits, the SQL Formatter on Toolexe re-indents statements without changing meaning.