Convert API responses, JSON exports, or newline-delimited JSON (NDJSON) into relational database tables and batched INSERT statements in seconds. Paste your JSON payload or upload a .json / .ndjson file; the tool automatically inspects all records, infers SQL data types, flattens nested object structures or preserves native JSON/JSONB columns, and generates dialect-appropriate DDL and batched DML for SQLite, MySQL, PostgreSQL, SQL Server, and Oracle. All processing runs entirely within your browser—no data is sent to SQLiz or any external server.
The JSON to SQL converter requires JavaScript to run in your browser. Please enable JavaScript to use this tool.
Convert JSON to Relational SQL Statements
Paste JSON arrays, single JSON objects, or newline-delimited JSON (NDJSON/JSONL). Nested objects can be flattened into prefixed relational columns or stored directly as JSON columns.
SQL statements are formatted for the selected database dialect. You can copy the code, download it as a .sql file, or run it immediately in the browser via SQLite Playground.
Paste JSON data or click "Load Sample JSON" to begin.
How JSON to SQL conversion works
Relational databases like MySQL, PostgreSQL, SQLite, and SQL Server store data in structured tables with typed columns, whereas JSON organizes data as flexible key-value trees. Converting JSON to SQL requires three steps:
- Schema Discovery: The converter scans all objects in the JSON payload (not just the first row) to identify the complete set of keys, accounting for sparse attributes where some records omit specific properties.
- Type Inference: Values are evaluated across all records to determine the narrowest compatible SQL data type:
BOOLEAN: Columns containing boolean literals (true,false).INTEGER/BIGINT: Whole numbers. Values exceeding 32-bit limits ($> 2,147,483,647$) automatically promote toBIGINT.NUMERIC/DECIMAL: Floating-point numbers and fixed decimals.DATE/TIMESTAMP: ISO 8601 strings such as2024-03-15or2024-03-15T09:30:00Zmap to dialect datetime types (TIMESTAMPTZin Postgres,DATETIMEin MySQL,DATETIME2in SQL Server).VARCHAR(n)/TEXT: Strings are sized with a safety buffer based on maximum observed character length.
- Dialect-Tailored DDL and Batched DML: Generates clean
CREATE TABLEstatements with proper identifier quoting, followed by multi-rowINSERT INTO ... VALUESstatements grouped into batches.
Handling nested JSON objects and arrays
When JSON contains nested objects (such as {"profile": {"city": "Berlin", "score": 98.5}}), you have two architectural choices:
Option 1: Flatten nested keys (Relational Normalization)
Flattening unrolls nested keys into separate columns using underscore delimiters:
profile.citybecomesprofile_city VARCHAR(32)profile.scorebecomesprofile_score DECIMAL(12, 4)
This approach is best when you want standard relational indexing, WHERE clauses, and aggregation without needing JSON query functions.
Option 2: Preserve as JSON / JSONB column (Document-Relational Hybrid)
Preserving nested objects serializes the child object into a string and assigns the target database’s native JSON type:
- PostgreSQL: Assigned
JSONBfor binary indexing via GIN and operators like->>or?. - MySQL / MariaDB: Assigned
JSONwith automatic document validation. See our MySQL JSON function guides for query patterns. - SQLite: Stored as
TEXTorJSONB(SQLite 3.45+). Can be queried using SQLite JSON and JSONB functions. - SQL Server: Stored as
NVARCHAR(MAX)or nativeJSON(SQL Server 2025). Can be queried usingJSON_VALUE()andOPENJSON(). - Oracle: Stored as
CLOBorJSON(Oracle 21c/23ai).
Database batch insert limits and dialect caveats
| Database | Multi-row VALUES Support |
Batch Row Constructor Ceiling | Native JSON Column Type |
|---|---|---|---|
| SQLite | Supported (3.7.11+) | Up to 500 rows recommended (compound limit) | TEXT / JSONB (SQLite 3.45+) |
| MySQL | Supported | Limited by max_allowed_packet |
JSON |
| PostgreSQL | Supported | Limited by 65,535 parameter ceiling if parameterized | JSONB / JSON |
| SQL Server | Supported | Strict 1,000-row constructor limit (Error 10738) | NVARCHAR(MAX) / JSON |
| Oracle | Supported (Oracle 23ai) / INSERT ALL |
Limited by statement size | CLOB / JSON |
For a comprehensive breakdown of multi-row insert mechanics, parameters, and bulk load tools like COPY and LOAD DATA, consult our comparative guide on SQL Bulk and Batch Insert by Database.
Client-side privacy guarantee
All data parsing, schema analysis, and SQL generation occur entirely in your browser using client-side JavaScript. Your JSON payloads, spreadsheets, API keys, and database contents are never transmitted to SQLiz servers, logged, or shared with third parties.