jsontoolskit.org
JSON and JSON Schema utilities, in the browser
Say hi →

JSON to CREATE TABLE

infer SQL column types from sample data · DDL for 3 dialects · updated 28 July 2026

Give it a JSON array and it writes the CREATE TABLE statement, choosing each column's type from the values actually present — integers, floats, booleans, ISO timestamps, dates, and JSON for nested structures. Columns that never hold a null get NOT NULL.

Paste input to start.

How to generate a CREATE TABLE statement from JSON

  1. Paste a JSON array. The more records you include, the better the inference — one record makes every column look required.
  2. Choose the Dialect. Type names differ: Postgres gets DOUBLE PRECISION and JSONB, MySQL gets DOUBLE and JSON, SQLite gets REAL and TEXT.
  3. Leave Add a primary key on. If your data has an id key it becomes the primary key; if not, an auto-incrementing id column is prepended.
  4. Check the inferred types in the output pane and adjust anything the sample could not reveal — precision, length limits, foreign keys.
  5. Copy or download the DDL, then use JSON → SQL INSERT on the same input to load the rows.

How each type is chosen

Where inference cannot help you

Types come from a sample, so treat the output as a first draft. Three things to check by hand:

Privacy

Nothing is uploaded. The conversion runs in this tab using your own browser's JavaScript engine — no server sees your data, and the page keeps working with the network disconnected.

FAQ

Why did a column come out as TEXT when it looks numeric?

Something in that column is not a number — often an empty string, a "N/A" placeholder, or a numeric string with a thousands separator. Mixed kinds always fall back to TEXT so no data is lost on load.

Does it create indexes?

No, only the primary key. Indexes depend on your query patterns, which a sample of data cannot reveal.

Can I get the INSERT statements too?

Yes — JSON → SQL INSERT takes the same input and the same column-naming options, so the two outputs line up.