Home → JSON to SQL Schema Generator
Generate SQL CREATE TABLE statements from any JSON object.
Generate SQL CREATE TABLE statements from any JSON object. This tool runs entirely in your browser — no data is ever sent to a server. Free to use, no account required.
The tool analyzes your JSON document and infers the SQL table structure needed to store that data in a relational database.
String values become VARCHAR or TEXT, integers become INT, decimal numbers become DECIMAL or FLOAT, booleans become BOOLEAN. Nested objects become separate related tables, and null-able fields get a NULL modifier.
Generates CREATE TABLE statements for MySQL, PostgreSQL, SQLite, and SQL Server. Switch between dialects to get syntax-appropriate output for your specific database system.
Converting JSON to SQL schema is the first step when moving from a document-based data model to a relational one.
Nested JSON objects become separate tables linked by foreign keys. The tool generates the full CREATE TABLE chain with proper foreign key constraints, following database normalization best practices.
Arrays of objects become related tables with a parent foreign key. Arrays of primitive values (like a list of tags) become a separate junction table or a comma-separated VARCHAR depending on your preference.
Generating SQL schema from JSON samples automates database design for data imports, API-to-database pipelines, and rapid prototyping.
// JSON Sample
{
"id": 1,
"username": "alice_dev",
"email": "alice@example.com",
"age": 30,
"score": 98.5,
"isActive": true,
"createdAt": "2024-01-15T10:30:00Z",
"tags": ["admin", "user"]
}
-- Generated PostgreSQL Schema
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
age INTEGER,
score DECIMAL(10, 2),
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP WITH TIME ZONE,
tags JSONB
);
| JSON Type | MySQL | PostgreSQL | SQLite | SQL Server |
|---|---|---|---|---|
| string | VARCHAR(255) | VARCHAR(MAX) | TEXT | NVARCHAR(255) |
| integer | INT | INTEGER | INTEGER | INT |
| float | DECIMAL(10,2) | DECIMAL(10,2) | REAL | DECIMAL(10,2) |
| boolean | TINYINT(1) | BOOLEAN | INTEGER | BIT |
| date | DATETIME | TIMESTAMP | TEXT | DATETIME2 |
| JSON | JSON | JSONB | TEXT | NVARCHAR(MAX) |
Explore more tools: All JSON Tools | Validator | Pretty Print | JSON Diff