ToolFeather
Developer / SEORuns in your browser

JSON to SQL Converter

Turn a JSON array into SQL: nested objects are flattened into columns, a CREATE TABLE is inferred from the values, and batched INSERT statements are written for your database.

Quick presets

JSON to SQL Converter

JSON
SQL

Table preview –

Runs in your browser — nothing you enter is uploaded or stored.

ToolFeather · JSON → SQL
Scratchpad auto-saved
Stored in this browser (localStorage)
Step-by-step~40s read

How it works — in four simple steps

No signup and nothing to install — it all runs in your browser.

1

Add your JSON

Paste it into the left box, press Open file, or drag a .json file onto it. Sample loads a realistic example.

2

Set the options

Adjust the options above the boxes — the output updates instantly as you change them.

3

Check the result

Read the status line: it reports rows, keys and any value that couldn't be represented in SQL.

4

Copy or download

Copy the SQL or download it as a .sql file. Nothing was uploaded at any point.

Pro tip

A key missing from some objects just becomes NULL in those rows — no need to normalise the JSON first.

Features

Nested data flattened

Nested objects become dotted columns (address.city), and arrays of plain values are joined so every row fits the grid.

Five SQL dialects

PostgreSQL, MySQL, SQLite, SQL Server and Oracle — with the right identifier quoting, boolean literals and column types for each.

Batched INSERTs

Rows are grouped into multi-row INSERT statements (capped at 1,000 for SQL Server) so large imports run fast.

CREATE TABLE included

Column types (INTEGER, DOUBLE, BOOLEAN, DATE, VARCHAR(n)…) are inferred from the actual values.

Private by design

Parsing and conversion run in your browser with JavaScript — your data is never uploaded, logged or stored.

About the JSON to SQL Converter

Seeding a database from fixture files, migrating API data or loading a NoSQL export into a relational table all start with JSON. This converter takes the array in your JSON (or the first array of objects inside it), flattens each object into columns — address.city becomes a column named address.city — and writes a CREATE TABLE plus INSERT statements.

Because JSON already has types, column inference is precise: JSON numbers become INTEGER/BIGINT or a floating type, JSON booleans become BOOLEAN (or the dialect's 0/1 type), and strings become DATE or TIMESTAMP when every value is an ISO date or date-time, VARCHAR(n) or TEXT otherwise. Keys missing from some objects simply produce NULL in those rows. Arrays of plain values are joined into text (a; b) and arrays of objects are stored as JSON text, which you can load into a JSON/JSONB column if your database has one.

Dialect handling matches CSV to SQL: correct identifier quoting, string escaping by doubling single quotes, N'' strings for SQL Server, INSERT ALL for Oracle, and a DROP TABLE line if you want the script to be re-runnable.

Examples

A small orders export from an API with a nested shipping object, ISO timestamps and a missing key.

JSON input
[
  { "id": 5001, "customer": "Ada", "total": 37.5, "paid": true, "placed_at": "2026-10-20T14:05:00Z", "shipping": { "city": "London", "method": "standard" } },
  { "id": 5002, "customer": "Alan", "total": 19, "paid": false, "placed_at": "2026-10-21T08:12:00Z", "shipping": { "city": "Manchester" } }
]
SQL output
CREATE TABLE `orders` (
  `id` INTEGER,
  `customer` VARCHAR(50),
  `total` DOUBLE,
  `paid` TINYINT(1),
  `placed_at` DATETIME,
  `shipping.city` VARCHAR(50),
  `shipping.method` VARCHAR(50)
);

INSERT INTO `orders` (`id`, `customer`, `total`, `paid`, `placed_at`, `shipping.city`, `shipping.method`) VALUES
  (5001, 'Ada', 37.5, 1, '2026-10-20 14:05:00', 'London', 'standard'),
  (5002, 'Alan', 19, 0, '2026-10-21 08:12:00', 'Manchester', NULL);

This output was produced by the converter on this page with table orders and the MySQL dialect — load it with the “Orders” preset above and change any option to see the effect.

How JSON maps to SQL

In JSONBecomes in SQL
Array of objectsone row per object
{"address": {"city": …}}column "address.city"
JSON integer / floatINTEGER / floating type
trueTRUE or 1 by dialect
"2026-10-21T09:30:00Z" (all rows)TIMESTAMP · DATETIME · DATETIME2
["a","b"]'a; b'
Missing key / nullNULL

Things that trip people up

JSON vs SQL at a glance

PropertyJSONSQL
SpecificationRFC 8259 (2017) · ECMA-404ISO/IEC 9075 + vendor dialects
File extension.json.sql
Media typeapplication/jsonapplication/sql (RFC 6922)
Data typesstring, number, boolean, null, object, arrayper column: INTEGER, DOUBLE, BOOLEAN, DATE, VARCHAR …
CommentsNoYes -- and /* */
NestingUnlimitedNone (tables)

Frequently asked questions

5 answers
How do I convert JSON to SQL INSERT statements?
Paste a JSON array of objects, choose the dialect and table name, and copy the CREATE TABLE and INSERT script.
What happens to nested JSON objects?
They're flattened into dotted column names, e.g. address.city. Untick Flatten nested keys to store each nested object as JSON text in one column.
Which databases are supported?
PostgreSQL, MySQL/MariaDB, SQLite, SQL Server and Oracle, each with its own quoting, boolean and type rules.
Can I skip the CREATE TABLE?
Yes — untick CREATE TABLE to get only the INSERT statements for an existing table.
Is my data uploaded anywhere?
No. The JSON is parsed and converted by JavaScript in your browser tab; nothing is sent to a server, so it is safe for internal exports, customer lists and configuration files with secrets.