JSON to SQL Converter.

Turn a JSON array of objects into ready-to-run SQL — CREATE TABLE with inferred types plus batched INSERTs — for MySQL, PostgreSQL, SQLite, or SQL Server. Private, in your browser.

No signup · No uploads · No file-size cap

SQL output

Convert JSON to SQL online — free and private

A JSON to SQL converter turns a JSON array of objects into SQL statements you can run to load the data into a database. Paste your JSON above, pick a dialect, and press Convert to SQL to get a CREATE TABLE plus INSERT statements. Because it runs client-side, you can convert JSON to SQL online without uploading production data.

How to convert JSON to SQL in three steps

  1. Paste your JSON array of objects, or click “Load sample”.
  2. Choose your options — database dialect, table name, CREATE TABLE, optional DROP, and batch size.
  3. Convert and export — copy the SQL or download it as data.sql.

Four dialects, real types, batched inserts

Many converters emit INSERT-only output for a single database. This one targets MySQL, PostgreSQL, SQLite, and SQL Server, each with correct identifier quoting and literal syntax. With type inference, it builds a CREATE TABLE where each column gets the right type — integer, floating point, boolean, JSON, or text. Inserts are grouped into multi-row batches you can size to your database, and nested objects are stored as JSON columns.

What the generated SQL looks like

This JSON:

[
  { "id": 1, "name": "Ada", "active": true, "joined": "2024-01-15" },
  { "id": 2, "name": "Alan", "active": false, "joined": "2024-03-02" }
]

becomes a table definition plus a single batched insert:

CREATE TABLE users (
  id       INT,
  name     VARCHAR(255),
  active   BOOLEAN,
  joined   DATE
);

INSERT INTO users (id, name, active, joined) VALUES
  (1, 'Ada',  TRUE,  '2024-01-15'),
  (2, 'Alan', FALSE, '2024-03-02');

Note the single multi-row INSERT. A thousand separate INSERT statements each carry their own round trip and transaction overhead, and can take minutes where one batched statement takes under a second.

Dialects are not interchangeable

Picking the right dialect matters more than people expect, because the same logical column is spelled differently in each database:

  • MySQL has no real BOOLEAN — it is TINYINT(1) — and quotes identifiers with backticks.
  • PostgreSQL has a true BOOLEAN and quotes identifiers with double quotes, which are case-sensitive.
  • SQLite is dynamically typed and has no dedicated date type at all.
  • SQL Server uses BIT for booleans, NVARCHAR for Unicode text, and square brackets for identifiers.

Generate for the wrong dialect and the script fails on the first line — so set it before you copy.

Nested JSON does not fit a flat table

SQL tables are rectangular; JSON is a tree. Nested objects are flattened into dot-notation columns, so address.city becomes an address_city column. That works well for one level of nesting.

Nested arrays are the harder case. A user with three orders cannot be one row without either duplicating the user across three rows or stuffing the orders into a single cell. If you need real relational structure, split the array into its own table with a foreign key back to the parent — that is a schema-design decision no converter can make for you. For a quick load, keeping the array as a JSON string in a JSON/JSONB column is often the pragmatic answer.

Always review the CREATE TABLE

Type inference reads your sample, and your sample is not your schema. A VARCHAR(255) sized from the longest name you happened to include will truncate the first longer one. An INT inferred from small IDs will overflow at 2.1 billion. No primary keys, indexes, or constraints are invented for you.

Treat the generated SQL as a fast first draft — excellent for loading data into a scratch table or a local database, and a starting point rather than a finished migration for production.

Why use this JSON to SQL tool?

It is 100% private with no file-size cap, and it handles escaping so your data loads safely. Working with other formats? Try JSON to CSV, JSON to Excel, or CSV to JSON. Learn more in our guide on how to convert JSON to SQL.

FAQ

JSON to SQL, answered.

How do I convert JSON to SQL online?+

Paste a JSON array of objects into the converter above, choose your database dialect, and press Convert to SQL. The tool generates a CREATE TABLE statement with inferred column types plus batched INSERT statements. Copy it or download a .sql file. Everything runs in your browser.

Which databases are supported?+

Four dialects: MySQL, PostgreSQL, SQLite, and SQL Server. Each uses the correct identifier quoting (backticks, double quotes, or brackets), data types, and boolean and Unicode literal syntax for that database.

Does it create the table and infer column types?+

Yes. With CREATE TABLE enabled, the tool scans your data and infers a type for each column — integer, floating point, boolean, JSON, or text — mapped to the right type for your chosen dialect. You can also add a DROP TABLE statement first.

How are nested objects and big datasets handled?+

Nested objects and arrays are stored as JSON text (a JSON/JSONB column where the database supports it). For large datasets, INSERTs are grouped into multi-row batches; set the batch size to match your database's limits.

Is my data private?+

Completely. The SQL is generated 100% client-side, so your JSON is never uploaded or stored. It is safe for production data, and there is no file-size cap.

How do I import JSON into MySQL or PostgreSQL?+

Generate the SQL here and run it. The tool produces a CREATE TABLE statement with inferred column types plus batched INSERT statements, so you can paste the whole script into your SQL client, psql, or the MySQL CLI. Pick the dialect first — quoting and type names differ between MySQL, PostgreSQL, SQLite, and SQL Server.

How are nested JSON objects turned into SQL columns?+

Nested objects are flattened into dot-notation columns, so address.city becomes a column named address_city. SQL tables are flat, so there is no other way to represent nesting in a single table. If you need true relational structure, split the nested arrays into their own tables and join on a foreign key.

How are column types inferred?+

By scanning your values. Integers become INT or BIGINT, decimals become DECIMAL or DOUBLE, true/false becomes BOOLEAN (or TINYINT in MySQL), ISO date strings become DATE or TIMESTAMP, and everything else becomes VARCHAR sized to your longest value. Always review the generated CREATE TABLE before running it in production — inference is a starting point, not a schema design.

Why are my inserts batched?+

Because one INSERT with a thousand value tuples runs dramatically faster than a thousand separate INSERT statements — each statement otherwise carries its own round trip and transaction overhead. The tool batches rows into multi-row INSERTs sized to stay within your database's statement limits.