Esta página ainda não foi traduzida para o português, por isso aparece em inglês.

JSON to SQL Converter

Paste a JSON array and get SQL that creates the table and inserts every object as a row — nested objects become columns or JSON values, and every string is escaped for your dialect.

Atualizado em
Open file (.xlsx, .csv, .json)
Input
Dialect
Statements

Input preview

Seus dados nunca saem do seu computador. Todo o processamento acontece localmente no navegador.

Como usar: JSON to SQL

  1. Paste a JSON array of objects or open a .json file.
  2. Choose whether nested objects are flattened into columns (dimensions_width) or stored as one JSON column.
  3. Select the SQL dialect, table name and the statements to include.
  4. Copy the SQL or download it as a .sql file.

What does JSON to SQL conversion do?

It maps a JSON array onto a relational table: every object becomes a row, every key a column. The converter scans all objects to collect the full set of columns (objects with missing keys get NULL), infers a SQL type for each column, and writes CREATE TABLE plus batched INSERT statements.

[{ "id": 1, "sku": "KB-001", "price": 89.99, "in_stock": true }]

becomes, for PostgreSQL:

CREATE TABLE "products" (
  "id" INTEGER,
  "sku" VARCHAR(16),
  "price" NUMERIC(10,2),
  "in_stock" BOOLEAN
);
INSERT INTO "products" ("id", "sku", "price", "in_stock") VALUES (1, 'KB-001', 89.99, TRUE);

Handling nested objects

OptionResultUse when
Flatten to columnsdimensions.width → column dimensions_widthYou want to filter and index the nested fields
Keep as JSON valueOne dimensions column of type JSON / JSONBThe structure varies or you query it with JSON functions

Arrays are always stored as JSON text. In PostgreSQL the JSON column type is JSONB, in MySQL JSON; SQLite, SQL Server and Oracle store it as text.

JSON types vs SQL types

  • Numbers: integers become INT (or BIGINT above 2,147,483,647); decimals become DECIMAL with enough precision for the largest value.
  • Booleans: TRUE/FALSE in MySQL and PostgreSQL, 1/0 in SQLite, SQL Server (BIT) and Oracle.
  • Strings that look like dates (2026-02-14 or ISO timestamps) become DATE or DATETIME/TIMESTAMP columns.
  • null always becomes NULL.

Before you run it

Check the generated VARCHAR lengths and add indexes or foreign keys your schema needs — or design the table yourself with the CREATE TABLE generator and generate only the inserts. If the JSON fails to parse, the JSON Formatter shows exactly where. Spreadsheet data? Use CSV & Excel to SQL.

Também pesquisado como: json to sql insert, json to mysql, json to postgresql, convert json to sql, json to sqlite, json to sql server, json to insert statement.

Ferramentas que combinam com: JSON to SQL

  • SQL to JSON, CSV & Excel — Paste a SQL dump or a few INSERT statements and get the rows back as JSON, CSV or an Excel workbook with one sheet per table.
  • JSON to Excel — Turn a JSON array into a real Excel workbook.
  • Excel to JSON — Open an .xlsx workbook or paste cells straight from Excel or Google Sheets and get clean JSON.
  • CSV & Excel to HTML Table — Paste spreadsheet cells, CSV or JSON and get semantic, escaped HTML table markup — with an optional ready-made style and a live preview.

Perguntas frequentes

What JSON shape does the converter need?
An array of objects works best. A single object becomes one row, and a root object that wraps an array (like {"items": [...]}) is unwrapped automatically.
How are nested arrays stored?
Arrays are written as JSON text in one column. To get a separate child table, convert that array on its own and add a foreign key column.
Can I use the output with MariaDB?
Yes. Choose the MySQL dialect — MariaDB accepts the same syntax, backtick quoting and multi-row inserts.
Does it work offline and privately?
Yes. The JSON is parsed and converted in your browser; nothing is uploaded.
Posso instalar o JSON to SQL como um aplicativo da web e usá-lo offline?
Sim. O JSON to SQL é um aplicativo da web instalável (PWA) — instalado a partir do seu navegador, não baixado de uma loja de aplicativos. Clique em “Instalar aplicativo” na parte superior desta página no Chrome ou no Edge (Windows, macOS, Linux, ChromeOS) ou, no Android, use “Compartilhar” → “Adicionar à tela inicial” no iPhone e no iPad, ou “Arquivo” → “Adicionar ao Dock” no Safari 17+ em um Mac. Em seguida, ela se abre em uma janela própria com seu próprio ícone e, como é executada inteiramente no seu navegador, continua funcionando offline. O Firefox no desktop não permite a instalação de aplicativos da web. Como funciona a instalação.

Ferramentas relacionadas