Database & SQL tools

JSON to SQLwith reviewable INSERT output

Choose JSON or CSV, inspect the target columns, and generate SQL for an existing table.

JSON to SQL

JSON or CSV input

SQL preview

Input stays in this browser. No database connection or upload is made.

Destination and conversion

One table identifier, up to 63 UTF-8 bytes. A dot is part of the name, not a schema separator.

Target columns and types

All source columns are included in discovery order. Renaming changes the destination; it does not edit the source.

Source columnid
Source columnname
Source columnactive
Source columnnote

Limits: 1000 data rows, 100 columns, 50,000 cells, 500,000 input characters and 2,000,000 output characters.

Result is out of date. Generate again to export.

JSON to SQL is useful when an API response needs to become a small, repeatable seed dataset. A quoted account code is different from a number, even when both contain the same digits.

The example includes an apostrophe, Unicode, a boolean and a missing value. Compare these literals before adapting the table name to your own schema.

Why use JSON to SQL?

Make column identity and value meaning visible before exporting.

Review the destination column list

JSON to SQL collects keys across all objects in first-seen order. Rename each destination and choose its value type; a missing key becomes NULL instead of shifting later values into the wrong column.

Two input cards converge into aligned target columns with matching colored cells.

Regroup rows without changing them

A batch size of one makes separate statements. Larger batches keep the same rows in grouped VALUES lists. The row count and statement count show what changed when you adjust the size.

Six colored table rows divided into two groups, with empty cells kept in their original positions.

Check meaning before running a script

01

Match the source format

CSV requires a header. JSON requires an array of flat objects, even for a single record. Switching the format does not rewrite the input.

  • Example replacement previews its character count and resets the options.
02

Separate text from numbers

Automatic mode preserves JSON string types. CSV infers strict numbers and true/false, while 007, dates and the word NULL stay text.

  • Force a column type only when every non-null value fits it.
03

Wait for a current result

Auto conversion waits 350 ms. Any input or option change immediately disables export until regeneration succeeds.

  • Turn automatic mode off to use the button or Ctrl/Cmd + Enter.

Control the generated statements

Four SQL dialects

PostgreSQL, MySQL, SQLite and SQL Server use their own identifier and string rules. SQL Server emits Unicode N strings; MySQL uses UTF-8 hexadecimal literals for backslashes and control characters to avoid dependence on backslash SQL modes.

Exact input numbers

The SQL INSERT generator preserves JSON numeric tokens, including large integers and long decimals. Explicit number mapping validates decimal syntax without converting through JavaScript numbers. Your database still decides the final column range and precision.

NULL and batch INSERT controls

CSV to SQL can map empty cells to NULL or empty strings. JSON null and missing keys always become NULL, while a JSON empty string stays empty. Batch INSERT accepts 1–1000 rows per statement; optional transaction markers surround the complete script.

Accepted data and deliberate limits

An existing table, without execution
Only INSERT text is generated. There is no connection, CREATE TABLE, UPSERT or schema inspection. Review types, constraints and transaction support in the destination database before executing the script.
Flat and complete records
Nested objects, arrays, standalone objects, NDJSON and JSON5 are rejected. Duplicate JSON keys, empty or repeated CSV headers, malformed quotes and uneven rows stop the whole conversion; there is no partial export.
Identifiers are not SQL expressions
Table and target names are quoted as individual identifiers, limited to 63 UTF-8 bytes. A dot remains part of the table name. Control characters, empty names and duplicate targets ignoring case are rejected. Every source column is included; there is no filtering or reordering.
Bounded seed data
The tool accepts up to 1000 data rows, 100 columns, 50,000 cells and 500,000 input characters; output is capped at 2,000,000 characters. These are UTF-16 code-unit counts. NUL and unpaired Unicode surrogates are rejected. Use database bulk loaders for larger imports.
No implicit data cleanup
Whitespace, dates, leading zeros and literal NULL text are preserved. There is no file upload, URL fetch or expression evaluation. Clear and example replacement require preview and apply; one undo restores input, options and output. Long results show 100 statements at a time, while exports include all.

JSON to SQL questions

How are SQL value types inferred from JSON?

JSON to SQL preserves JSON strings, numbers, booleans and null in automatic mode. CSV has no native types, so only strict decimal numbers and true/false are inferred. Column overrides can force text, number or boolean; incompatible values stop generation.

Can INSERT output also create the destination table?

No. The destination table must already exist. Creating its schema requires decisions about lengths, primary keys, defaults and indexes that cannot be reliably inferred from a few rows. Generate the INSERT script here and review it against your schema.

Which SQL dialects does the converter support?

Choose PostgreSQL, MySQL, SQLite or SQL Server. The selection controls identifier quoting, string literals, boolean values and transaction markers. It does not validate the script against a live server or its specific configuration.

How are quotes in text values escaped?

Apostrophes are doubled inside string literals. PostgreSQL uses E strings with doubled backslashes; SQL Server uses N strings. MySQL switches backslash or control-character values to UTF-8 hexadecimal literals. Values are never inserted as raw SQL expressions.

What happens to missing JSON keys and null values?

All discovered keys form the output column list. A missing key or JSON null yields SQL NULL. JSON empty strings stay empty strings. CSV empty cells follow the empty-cell option, but the letters NULL are always a text value.

Found a formatting problem?

Prepare the script for review

Use JSON to SQL with a small representative sample, confirm the column mapping, then copy or download the complete script.