← All Tools
JSON To SQL Schema Converter🔒 100% local
Convert JSON to CREATE TABLE. Privacy-first, no server uploads, no tracking.
Infers a CREATE TABLE statement from one JSON object or an array of objects. Every key seen across the records becomes a column, values decide the type (INTEGER, REAL, BOOLEAN, or TEXT for strings and for anything nested), a column is NOT NULL unless some record carried null, and a key named id, ending in _id or named uuid becomes the primary key. The table is always called my_table.
How to use it
- Paste a JSON object, or an array of objects that share a shape.
- Run the tool to infer the schema.
- Copy the DDL and rename the table - the generated comment gives the sed command.
Worked example
{"id":1,"name":"Widget","price":4.5}becomes-- Inferred schema from 1 record
CREATE TABLE my_table (
id INTEGER NOT NULL,
name TEXT NOT NULL,
price REAL NOT NULL,
PRIMARY KEY (id)
);
-- Notes:
-- • Mixed-type columns resolved to a common supertype (TEXT absorbs all).
-- • INTEGER/REAL inference from sample values — verify before migrating real data.
-- • Nested objects/arrays mapped to TEXT (store as JSON).
-- • Rename the table: sed 's/my_table/your_name/'Column names are padded so the types line up, and the primary key clause is added because a column is named id. The notes block is emitted verbatim by the tool, bullet points and all.
When to use it
- Bootstrapping a table from a sample of what an API actually returns.
- Loading a JSON export into SQLite or Postgres for a one-off query session.
- Reviewing, column by column, what a payload looks like once it is flattened into a relation.
What it does not do
- One sample decides everything: a column that is null in your data is typed from nothing and falls back to TEXT, and a column holding two types collapses to TEXT.
- Nested objects and arrays are stored as TEXT with no child tables, no foreign keys and no array handling.
- There is no INSERT generation, no indexes and no defaults, and the SQL is dialect-neutral rather than tuned for one engine - NOT NULL on every non-null sample column in particular is usually stricter than you want.