Advertisement

JSON to SQL Table

Generate SQL CREATE TABLE statements from JSON. Nested objects are flattened into prefixed columns and arrays become JSON text columns.

JSON input

Paste JSON, optionally name the root type, then generate.

Your SQL CREATE TABLE code will appear here.
Advertisement

Flattening JSON for relational storage

JSON nests freely while tables do not. The generator walks your payload and flattens each level into prefixed columns, so a three level deep object becomes a single wide table you can CREATE and load immediately.

A starting schema, not the final one

Auto inferred schemas are drafts: review column widths, add primary keys and indexes, and normalize repeated structures before production. The value is skipping the tedious first pass.

JSON to SQL Table FAQs

How are nested objects handled?
Nested objects are flattened with prefixed column names, so address.city becomes address_city. This keeps everything in one table without joins.
What SQL types are used?
Text becomes TEXT, whole numbers INTEGER, decimals REAL, booleans BOOLEAN, and arrays or mixed values become TEXT holding JSON, which works across database engines.
How is nullability decided?
Columns for fields that were null or missing in the sample allow NULL; the rest are NOT NULL, reflecting the reliability of your sample data.
Which databases is this compatible with?
The generated DDL uses standard types that run on PostgreSQL, MySQL, SQLite, and SQL Server with little or no modification.
Should arrays really be JSON text?
For a quick import, yes. If the array needs querying or relations later, normalize it into a child table with a foreign key instead.
Advertisement