JSON to SQL
Convert an array of JSON objects into CREATE TABLE and INSERT statements, flattening nested objects and storing arrays as JSON.
Local workspace
Named projects in IndexedDB · Local only — never synced to our servers. Worksp…
Batch workspace
Format multiple files locally in one run.
Options
| Option | Description |
|---|---|
| Dialect | Sets how identifiers are quoted, which types are used, and how booleans are written. |
| Table name | Name used in the CREATE TABLE and INSERT statements. |
| Include CREATE TABLE | Turn off when the table already exists and you only need the inserts. |
| Flatten nested objects | On, user.email becomes its own column. Off, the whole nested object is stored as JSON in one column. |
| Rows per INSERT | Multi-row inserts load faster, but very large batches can exceed a server's packet limit. |
FAQ
What happens to nested objects?
They're flattened into dotted column names, so user.email becomes a column called user.email, quoted for your dialect. Turn flattening off to keep the object together and store it as JSON in a single column.
How are arrays stored?
As JSON text, since a relational column can't hold a list. In PostgreSQL you can change the generated column type to JSONB, or split the values into a separate table if you need to query them.
What if some objects are missing keys?
The column list is the union of every object's keys, in the order they first appear, and any record without a key gets NULL for it. That keeps one INSERT shape for all rows.
How are column types decided?
By the values: whole numbers become integers, decimals numeric, true and false boolean, ISO dates and timestamps their date types, and anything mixed falls back to text.
Does the input have to be an array?
A single object works too and becomes one row. Arrays of plain values, such as [1, 2], can't become rows because there are no column names to use.