JSON to SQL Converter
Convert a JSON array of objects into a CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQLite, SQL Server, or ANSI SQL.
Paste a JSON array of objects on the left.
What is JSON to SQL Converter?
JSON to SQL Converter turns a JSON array of objects into ready-to-run SQL: a CREATE TABLE with inferred column types, followed by INSERT statements carrying the data. The header/columns are the union of every object's keys (in first-seen order), so a heterogeneous array — where some objects omit a field others have — still converts cleanly, with missing keys becoming NULL rather than breaking the conversion. Column types are inferred from the values actually present (INTEGER, a floating type, BOOLEAN, or TEXT), nested objects and arrays are serialized to JSON text since SQL has no native equivalent, and output is dialect-aware across PostgreSQL, MySQL, SQLite, SQL Server, and ANSI SQL — each with correct identifier quoting and type names so the generated SQL runs without hand-editing.
How to Use JSON to SQL Converter
- Paste a JSON array of objects into the input box on the left.
- Set the table name and pick a SQL dialect.
- Toggle Include CREATE TABLE on for a full schema, or off for INSERT statements only against an existing table.
- Choose how many rows go into each INSERT — one per statement, or batched (10/50/100) for faster bulk loads.
- Copy the generated SQL from the right and run it against your database.
Examples
Basic array with inferred types
Input: [{"id":1,"name":"Ada","active":true},{"id":2,"name":"Alan","active":false}]
Output: CREATE TABLE "users" ( "id" INTEGER, "name" TEXT, "active" BOOLEAN ); INSERT INTO "users" ("id", "name", "active") VALUES (1, 'Ada', TRUE);
Heterogeneous objects — missing key becomes NULL
Input: [{"id":1,"name":"Ada"},{"id":2}]
Output: INSERT INTO "users" ("id", "name") VALUES (1, 'Ada'); ... (2, NULL);
Common Mistakes
- Leaving Include CREATE TABLE on when the target table already exists — this produces a duplicate-table error; turn it off for INSERT-only output.
- Assuming inferred BOOLEAN/INTEGER types exactly match your real schema — review the generated CREATE TABLE before running it against production.
- Passing a single JSON object instead of an array — only a top-level array of objects converts to rows; a bare object is rejected.
- Forgetting that nested arrays/objects become JSON text, not a native array/JSON column — adjust the CREATE TABLE column type by hand if your database supports one.
Why Use This Tool
- Handles heterogeneous objects — missing keys become NULL instead of breaking the conversion.
- Infers INTEGER, floating-point, BOOLEAN, or TEXT per column from the actual JSON values.
- Five dialects (PostgreSQL, MySQL, SQLite, SQL Server, ANSI SQL) with correct identifier quoting and type names for each.
- Adjustable INSERT batching for either maximum portability (one row each) or faster bulk loads (many rows per statement).
- Runs entirely in your browser — the JSON data never leaves your machine.