πŸ“Š JSON to SQL

Convert JSON to SQL CREATE TABLE and INSERT statements

Input

πŸ’‘ Add a JSON array or object below. Types are detected automatically.
All processing happens locally in your browser β€” no data is sent anywhere.
πŸ“Œ Schema: PostgreSQL uses a schema, MySQL uses a database, SQLite has no schema.
πŸ’° Fields named price, cena, iznos, vrednost, quantity, kolicina, amount, total, cost, tezina, procenat, popust, discount, percentage, tax, vat, pdv, percent (or variants like unit_price) default to NUMERIC(16,2) even when the values are whole numbers.
⚠️ Generated code is provided "as is". Always verify generated SQL before running on production databases. Read our Terms of Service.
Normalized (master–detail): nested 1:1 objects are flattened into prefixed columns (see Depth below); every array of objects becomes a detail table with an <parent>_id foreign key, recursively (master β†’ detail β†’ detail…). Objects deeper than Depth are stored as JSON.
How many levels of nested 1:1 objects to flatten into prefixed columns. 0 = no flattening (objects stay JSON); 1 = a_x; 2 = a_b_x; etc. Arrays of objects always become detail tables, regardless of this value. (Default 2 = the previous behaviour.)
You can either upload a file or paste JSON directly above.

SQL Result

βœ… Generated SQL code appears here