What this tool does
A JSON sample becomes a CREATE TABLE.
{ "id": 1, "firstName": "Ada", "score": 9.5, "address": { "city": "Paris" } }
CREATE TABLE `root` (
`id` BIGINT NOT NULL,
`first_name` VARCHAR(255) NOT NULL,
`score` DOUBLE NOT NULL,
`address` JSON NOT NULL
);
Column names are snake_case and backticked, so a reserved word or a dash in a key is not a problem. Two keys that collapse to the same name are suffixed rather than merged.
A column that fits the value
Strings become VARCHAR(255) — except when the sample shows they do not fit:
{ "bio": "…301 characters…" }
`bio` TEXT NOT NULL
MySQL in strict mode — the default since 5.7 — rejects a value longer than the column with error 1406. A VARCHAR(255) here would have given you a table that cannot hold the document that generated it. That was a real defect, found while writing this page and fixed.
The cut-off is the sample’s own longest value, so it is a floor, not a promise: if production strings run longer than what you pasted, widen the column.
All the rows, not just the first
[{ "a": 1 }, { "a": 2, "b": "x" }]
CREATE TABLE `root_item` (
`a` BIGINT NOT NULL,
`b` VARCHAR(255) NULL
);
The table used to be built from the first object alone, so the second row of your own sample would fail to insert — Unknown column 'b'. The columns are now the union of every object, and a key missing from some of them is nullable, because it is.
The type follows the same rule. A key that holds 1 on one row and "x" on the next used to take whichever type came first, and the other value then had no column to go into; it gets a JSON column now, which holds both. A 300-character value that only shows up on the tenth row widens that column to TEXT just as it would have on the first.
What is not invented
- No primary key, no index, no engine or charset clause. All of them are decisions about your data and your server; a document says nothing about them.
NOT NULLeverywhere a value was present,NULLfor anulland for a key that is missing from some rows.- Objects and arrays become
JSONcolumns. No related table, no foreign key: a sample cannot show a relation, and inventing one would be three guesses stacked.
Private by design
Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.