JSON to CREATE TABLE
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.
How to generate a CREATE TABLE statement from JSON
- Paste a JSON array. The more records you include, the better the inference — one record makes every column look required.
- Choose the Dialect. Type names differ: Postgres gets
DOUBLE PRECISIONandJSONB, MySQL getsDOUBLEandJSON, SQLite getsREALandTEXT. - Leave Add a primary key on. If your data has an
idkey it becomes the primary key; if not, an auto-incrementingidcolumn is prepended. - Check the inferred types in the output pane and adjust anything the sample could not reveal — precision, length limits, foreign keys.
- Copy or download the DDL, then use JSON → SQL INSERT on the same input to load the rows.
How each type is chosen
- BIGINT — every value in the column is a whole number.
- DOUBLE PRECISION / DOUBLE / REAL — at least one value has a fractional part.
- BOOLEAN (
TINYINT(1)on MySQL) — every value istrueorfalse. - TIMESTAMPTZ / DATETIME — every value matches an ISO 8601 date-time, e.g.
2026-07-28T10:00:00Z. - DATE — every value matches
YYYY-MM-DD. - JSONB / JSON / TEXT — the value is a nested object or array (or a string that parses as one).
- VARCHAR(n) — MySQL only, when the longest observed string is under 512 characters. The limit is padded by 50% to leave room.
- TEXT — the fallback, including any column whose values mix several of the kinds above.
Where inference cannot help you
Types come from a sample, so treat the output as a first draft. Three things to check by hand:
- Money. A price of
9.5infers as a float. Financial columns almost always wantNUMERIC(12, 2). - Large integers. IDs beyond 253 lose precision in JavaScript before this tool ever sees them. If your IDs are big, keep them as strings in JSON and make the column
TEXTorNUMERIC. - NOT NULL. A column is marked
NOT NULLonly when no sampled record had a null or missing value. A larger sample may disagree.
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.