JSON to SQL Converter Online — Free INSERT & CREATE TABLE

JSON to SQL Converter

Convert JSON arrays to SQL CREATE TABLE and INSERT statements.

Free online JSON to SQL converter. Paste a JSON array or object and instantly generate SQL CREATE TABLE DDL with auto-inferred column types (VARCHAR, BIGINT, BOOLEAN, TEXT) plus batched INSERT statements. Supports PostgreSQL, MySQL, SQLite, and SQL Server dialects. Options for upsert mode, null handling, and batch size. No data is ever sent to a server — runs entirely in your browser.

Keywords: json to sql, json to sql converter, json to sql online, json to insert statement, json to create table, json to sql server, json to mysql, json to postgresql, json to sqlite, convert json to sql, json array to sql, json to ddl, json to database, generate sql from json, json to sql insert, json to sql table

Tags: json, sql, converter, ddl, insert, postgresql, mysql, sqlite

Browse all 35 Developer Tools tools →

How to JSON to SQL Converter Online

  1. Paste or type your JSON object or array into the input panel on the left.

  2. Select your target SQL dialect from the dropdown — PostgreSQL, MySQL, SQLite, or SQL Server.

  3. Configure options such as table name, batch insert size, and whether to generate UPSERT statements.

  4. Click "Convert" or press ⌘↵ to generate the SQL DDL and INSERT statements.

  5. Copy the output with ⌘⇧C or download it as a .sql file for use in your database client.

JSON to SQL Converter Features

  • Supports four major SQL dialects: PostgreSQL, MySQL, SQLite, and SQL Server with dialect-specific syntax

  • Automatically infers column types from JSON values — INTEGER, BIGINT, NUMERIC, BOOLEAN, TEXT, and TIMESTAMP

  • Generates CREATE TABLE DDL with appropriate constraints and column definitions

  • Produces batched INSERT statements configurable by row count for optimal import performance

  • Optional UPSERT mode (INSERT … ON CONFLICT / INSERT … ON DUPLICATE KEY UPDATE) for idempotent imports

  • Handles nested JSON objects by flattening them into dot-separated column names

  • Detects JSON arrays and maps them to TEXT columns with JSON serialization

  • Proper NULL handling — JSON null values map to SQL NULL, respecting NOT NULL constraints

  • Processes arrays of objects to derive a unified schema from all rows

  • Runs entirely in your browser — your data is never uploaded to any server

  • Keyboard shortcut ⌘↵ to convert instantly, ⌘⇧C to copy output

  • Shareable URLs encode your input and options for easy collaboration

  • AI-powered explanations help you understand generated SQL and type inference decisions

Supported SQL Dialects

The JSON to SQL Converter supports 4 SQL dialects. Select the right dialect for accurate formatting and keyword recognition.

PostgreSQL
Uses SERIAL/BIGSERIAL for auto-increment, native BOOLEAN type, JSONB for nested structures, and INSERT … ON CONFLICT DO UPDATE for upserts.
MySQL
Uses AUTO_INCREMENT, TINYINT(1) for booleans, TEXT for long strings, and INSERT … ON DUPLICATE KEY UPDATE for upsert operations.
SQLite
Uses INTEGER PRIMARY KEY AUTOINCREMENT, dynamic typing (no strict BOOLEAN column), and TEXT for most string and JSON values.
SQL Server
Uses IDENTITY(1,1) for auto-increment, BIT for booleans, NVARCHAR(MAX) for Unicode strings, and MERGE statements for upserts.

Frequently Asked Questions

What JSON format does the converter accept?
The converter accepts a JSON object (to generate a single INSERT row) or a JSON array of objects (to generate multiple rows). All objects in an array should share the same keys for the most accurate schema inference. Primitive arrays are also supported but are serialised as JSON text columns.
Which SQL dialects are supported?
Four dialects are supported: PostgreSQL (uses SERIAL / BIGSERIAL primary keys, BOOLEAN, JSONB), MySQL (uses AUTO_INCREMENT, TINYINT(1) for booleans, TEXT), SQLite (dynamic typing, INTEGER PRIMARY KEY AUTOINCREMENT), and SQL Server (uses IDENTITY(1,1), BIT for booleans, NVARCHAR).
How does automatic type inference work?
The converter examines every value across all rows for each key. Integers map to INTEGER or BIGINT, decimals to NUMERIC/REAL, booleans to BOOLEAN/BIT, ISO 8601 date strings to TIMESTAMP, and all other strings to TEXT/VARCHAR. If a column has mixed types, it falls back to TEXT.
Can it handle nested JSON objects?
Yes. Nested objects are flattened using dot notation — e.g., `{ "address": { "city": "NY" } }` becomes a column named `address.city`. For deeply nested or irregular structures, consider flattening your JSON manually before converting.
What is UPSERT mode?
UPSERT mode generates INSERT statements that update existing rows instead of failing on duplicate primary keys. PostgreSQL uses `ON CONFLICT DO UPDATE`, MySQL uses `ON DUPLICATE KEY UPDATE`, and SQL Server uses a MERGE statement. Enable it when importing data that may already exist in the target table.
Is my data safe to paste here?
Yes. All conversion happens locally in your browser using JavaScript — your JSON data is never sent to any server. You can verify this by disabling your network connection before converting.
How should I handle large JSON arrays?
Use the batch size option to split INSERT statements into groups (e.g., 500 rows per statement). This avoids database packet-size limits and makes it easier to run imports incrementally.
What is the difference between this tool and writing SQL manually?
Manual SQL authoring requires knowing exact column types, escaping strings, and formatting syntax correctly. This tool automates type inference, escaping, and dialect-specific syntax — saving significant time when importing JSON data exports from APIs or other systems.