JSON Parser

JSON to SQL Converter — CREATE TABLE and INSERT

Turn a JSON array into a CREATE TABLE statement and one INSERT per object, for PostgreSQL, MySQL, SQLite or SQL Server. Column types are inferred from your data, strings are escaped, and nothing leaves your browser.

How to convert JSON to SQL

  1. Paste a JSON array of objects (a single object works too).
  2. Enter the table name and pick your database from the dropdown.
  3. Copy the generated script and run it in your SQL client.

Example (PostgreSQL)

JSON input

[
  { "id": 1, "name": "Alice", "active": true, "score": 98.5 },
  { "id": 2, "name": "O'Brien", "active": false, "score": 71.25 }
]

SQL output

CREATE TABLE "users" (
  "id" BIGINT,
  "name" VARCHAR(255),
  "active" BOOLEAN,
  "score" DOUBLE PRECISION
);

INSERT INTO "users" ("id", "name", "active", "score") VALUES (1, 'Alice', TRUE, 98.5);
INSERT INTO "users" ("id", "name", "active", "score") VALUES (2, 'O''Brien', FALSE, 71.25);

Column types by database

JSON valuePostgreSQLMySQLSQLiteSQL Server
whole numberBIGINTBIGINTINTEGERBIGINT
decimal numberDOUBLE PRECISIONDOUBLEREALFLOAT
booleanBOOLEANTINYINT(1)INTEGERBIT
short string (up to 255)VARCHAR(255)VARCHAR(255)TEXTNVARCHAR(255)
long stringTEXTTEXTTEXTNVARCHAR(MAX)
nested object or arrayJSONBJSONTEXTNVARCHAR(MAX)

Good to know

  • Identifiers are quoted for each database: double quotes for PostgreSQL and SQLite, backticks for MySQL, square brackets for SQL Server.
  • Single quotes inside strings are doubled, and SQL Server strings use the N'' prefix. null becomes NULL.
  • The column set is the union of keys across all objects; a key missing from an object is inserted as NULL.
  • No primary key or constraints are added. Review the types and add keys or indexes yourself before using it in production.

Related tools

Tidy the output with the SQL formatter, flatten nested JSON first with JSON Flatten, convert to CSV, or generate typed code with JSON to Go and JSON to Java.

Frequently asked questions

How do I convert JSON to SQL INSERT statements?
Paste a JSON array of objects, choose your database and table name, and copy the output. The tool creates a CREATE TABLE statement with inferred column types, then one INSERT per object.
Which databases are supported?
MySQL, PostgreSQL, SQLite and SQL Server. Identifiers are quoted the right way for each (backticks, double quotes or brackets), and types map accordingly — for example BOOLEAN in PostgreSQL, TINYINT(1) in MySQL and BIT in SQL Server.
What happens to nested objects and arrays?
Nested values are stored as JSON text in a JSONB/JSON column (or TEXT/NVARCHAR(MAX) where JSON types don't exist). Single quotes in strings are escaped. Everything runs in your browser — your JSON is never uploaded to a server.
Handles JSON files up to 20MB smoothly