SQL to JSON Schema
Transform SQL CREATE TABLE statements into
production-ready JSON Schema and Zod TypeScript validation. 100% client-side — your SQL never leaves your browser.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "users",
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "PRIMARY KEY, AUTO_INCREMENT"
},
"username": {
"type": "string",
"maxLength": 50,
"description": "UNIQUE"
},
"email": {
"type": "string",
"maxLength": 255
},
"age": {
"type": "integer"
},
"status": {
"enum": [
"active",
"pending",
"deleted"
],
"default": "active"
},
"created_at": {
"type": "string",
"default": "CURRENT_TIMESTAMP"
}
},
"required": [
"username",
"email"
]
}What Gets Converted?
- ✓ Column types: INT → number, VARCHAR → string, BOOLEAN → boolean, etc.
- ✓ VARCHAR length: VARCHAR(50) → maxLength: 50 in JSON Schema, .max(50) in Zod
- ✓ NOT NULL: Adds column to 'required' array, removes .optional() from Zod
- ✓ DEFAULT values: Captured in both schemas using .default()
- ✓ ENUM values: ENUM('a','b') → z.enum(['a','b']) and JSON enum array
- ✓ Metadata: PRIMARY KEY, UNIQUE, AUTO_INCREMENT preserved in descriptions
Use Cases
- → Database migrations: Convert existing tables to TypeScript types
- → API documentation: Generate OpenAPI schemas from SQL
- → Form validation: Use Zod schemas with React Hook Form or Formik
- → ORM integration: Seed Prisma, Drizzle, or TypeORM schemas
Explore More Developer Tools
Boost your productivity with our other privacy-first utilities.
New
AI Mock Generator
Generate realistic mock data from natural language prompts. Runs entirely in your browser — no API keys required, no data leaves your machine.
Live
JWT Debugger
Decode, inspect, and validate JWT token headers and payloads without sending credentials to any server. Fully offline, privacy-first debugging.
New
Aurora Gradient Generator
Create animated, pure CSS aurora backgrounds and mesh gradients. Generate Tailwind classes or raw CSS instantly. 100% local, privacy-first execution.