Generator

JSON to SQL

Point it at an array of objects and get a CREATE TABLE with inferred column types plus the INSERT statements to load it. Nested objects and arrays are stored as JSON text columns.

JSON array
Waiting for input.
SQL

Values are inlined as literals with quotes escaped — fine for seeding and fixtures, but use parameterised queries for anything driven by untrusted input. ⌘/Ctrl + Enter runs it again. Everything happens in this browser — nothing is uploaded.

About the JSON to SQL generator

Getting a JSON export into a database usually means writing the DDL by hand. This infers column types from every row rather than the first — a column holding 1, 2 and 3.5 becomes decimal, and a column that is ever missing or null becomes nullable — then emits a CREATE TABLE and the INSERT statements to load it, quoted correctly for your dialect.

How to use it

  1. Paste an array of JSON objects.
  2. Pick the dialect and table name, and whether columns are converted to snake_case.
  3. Copy the SQL, or download it as a .sql file.

Questions

Which databases are supported?

PostgreSQL, MySQL, SQL Server and SQLite. Identifier quoting, boolean literals and type names follow each dialect — JSONB for Postgres, JSON for MySQL, NVARCHAR(MAX) for SQL Server, TEXT for SQLite.

What happens to nested objects and arrays?

They are stored as JSON text in a single column, which is what all four databases would have you do anyway. Flatten them first with the CSV tool if you want separate columns.

Is the generated SQL safe to run?

Values are inlined as escaped literals, which is fine for seeding and fixtures. Do not build a pipeline that inlines untrusted input this way — use parameterised queries for anything user-driven.