DEVELOPER & DATA

JSON to SQL Insert

Turn a JSON array of objects into SQL INSERT statements for PostgreSQL, MySQL, SQLite or SQL Server — proper quoting, multi-row batches, optional CREATE TABLE.

INSERT statements (one per row or batched VALUES lists), an optional inferred CREATE TABLE, an optional transaction wrapper, and the column list with inferred types.

Example: [{"id":1,"name":"O'Brien","ok":true},{"id":2,"score":3.5}] → INSERT INTO "people" ("id", "name", "ok", "score") VALUES (1, 'O''Brien', TRUE, NULL), (2, NULL, NULL, 3.5); CREATE TABLE inferred.

v0.1.0 · last reviewed 21 September 2026
Loading the workspace…
BUILT TO BE UNDERSTOOD

Rows in,
statements out.

How columns, literals and types are derived, and what stays your job.

Columns and rows

An array of objects is one table; an object of arrays is one table per key; a single object is one row. Columns are the union of keys in the order first seen, and a row without a key gets NULL. Nested objects and arrays are written as JSON text, since a flat INSERT cannot hold them.

Literals per dialect

Strings are single-quoted with quotes doubled; MySQL additionally doubles backslashes because its default sql_mode treats them as escapes; SQL Server prefixes non-ASCII strings with N. Booleans are TRUE/FALSE on PostgreSQL and MySQL, 1/0 on SQLite and SQL Server. Identifiers are quoted in the dialect’s style — double quotes, backticks or brackets — so reserved words and spaces are safe.

Inferred types

The optional CREATE TABLE types each column from the values seen: INTEGER, a double-precision real, BOOLEAN (or BIT / TINYINT(1)), a JSON type where the dialect has one, otherwise TEXT; NOT NULL when no row was null. That is a starting point, not a schema: strings that look like dates or numbers stay TEXT, and no primary key, index or constraint is added. Nothing leaves the browser; the same four anonymous usage counts as the rest of the site apply.

SOURCES

  • Identifier quoting per dialect (double quotes, backticks, brackets); quotes doubled, backslash doubled for MySQL default sql_mode, N prefix for non-ASCII on SQL Server; nested values as JSON text

Last reviewed 21 September 2026. How results are checked: How we verify.