Instantly convert JSON data to SQL statements. Generate INSERT INTO or CREATE TABLE queries from JSON objects or arrays. Supports MySQL, PostgreSQL, SQL Server, and more.
This tool parses valid JSON (either an object or an array of objects) and translates it into structured SQL statements. You can generate INSERT statements for each row, or a CREATE TABLE statement with inferred column types based on the JSON values. The conversion respects SQL dialect rules, string escaping, and identifier quoting to ensure the output is ready for execution in your database.
When generating a CREATE TABLE statement, the tool scans the JSON data to determine appropriate SQL data types:
| JSON type | Inferred SQL type (MySQL) | PostgreSQL | Generic |
|---|---|---|---|
| integer | INT(11) | INTEGER | INTEGER |
| float / double | DECIMAL(20,8) or DOUBLE | DOUBLE PRECISION | FLOAT |
| boolean | TINYINT(1) | BOOLEAN | BOOLEAN |
| string (short < 255) | VARCHAR(255) | VARCHAR(255) | VARCHAR(255) |
| string (long ≥ 255) | TEXT | TEXT | TEXT |
| null | VARCHAR(255) (fallback) | TEXT | VARCHAR(255) |
| array / object | TEXT (JSON stored as string) | JSONB (PostgreSQL) or TEXT | TEXT |
CREATE TABLE mode, array/object fields are mapped to JSONB. For optimal query performance, consider creating a GIN index on JSONB columns:CREATE INDEX idx_doc_data ON your_table USING GIN (jsonb_column);INSERT statements (one per JSON object) or a CREATE TABLE statement that defines the table structure.
Input must be a valid JSON value:
Nested objects and arrays are converted to string representations (JSON.stringify) to maintain data integrity.
[
{"first_name": "Alice", "age": 30, "is_active": true},
{"first_name": "Bob", "age": 25, "is_active": false}
]
→ Generates two INSERT statements with proper escaping.