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
Related tools
All Data Conversion tools Prisma to Zod Transform Prisma schema models into type-safe Zod validation schemas with field constraints, enums, and relation handling. Browser-only processing. SQL to Drizzle ORM Schema new Convert PostgreSQL, MySQL or SQLite CREATE TABLE statements into a typed Drizzle ORM schema with references, composite keys and relations. JSON Formatter & Beautifier new Beautify or minify JSON with exact error line and column, a tree view, sort keys and one-click repair. Opens files up to 50 MB, all in your browser. Aurora Gradient Generator popular Create animated, pure CSS aurora backgrounds and mesh gradients. Generate Tailwind classes or raw CSS instantly. 100% local, privacy-first execution. OpenAPI to Zod popular Parse OpenAPI 3.x specifications and instantly generate TypeScript Zod validation schemas for all components. 100% client-side execution. SQL to Prisma Schema popular Convert SQL CREATE TABLE statements into Prisma schema models. 100% offline client-side parsing.
Next step
Need this built into your stack?
The team behind SyntaxSnap builds custom code generators, internal developer tools and API integrations.