JSON to Prisma Schema Generator

Convert JSON data to Prisma ORM model definitions with type inference, @id detection, and timestamp support.

What is JSON to Prisma Schema Generator?

Prisma is a next-generation ORM for Node.js and TypeScript. This tool generates Prisma schema model definitions from your JSON data, automatically inferring field types, detecting id fields, and adding common annotations like @unique and @updatedAt.

How to Use

  1. Set the model name and choose your database provider in the options above
  2. Toggle the id field, timestamps, and @unique on email options as needed
  3. Paste your JSON data into the input area
  4. Click "Generate Schema" to create the Prisma schema
  5. Copy the output and save it as schema.prisma in your project

Why Use This Tool?

Automatically infer Prisma types from JSON values
Detect id fields and email fields for @id and @unique annotations
Add createdAt and updatedAt timestamps with proper defaults
Support for PostgreSQL, MySQL, and SQLite providers

Tips & Best Practices

  • Use realistic sample data — the type inference depends on actual values
  • ISO date strings (e.g. "2024-01-15T10:30:00Z") are automatically mapped to DateTime
  • Null values make the field optional (Type?) in the generated schema
  • Nested objects and arrays are mapped to the Json type

Frequently Asked Questions

What is Prisma Schema?

Prisma Schema is a declarative configuration language used by Prisma ORM to define database models, relations, and datasource settings. It serves as the single source of truth for your database structure and is used to generate type-safe database clients.

How are JSON types mapped to Prisma?

JSON strings → String, integers → Int, floats → Float, booleans → Boolean, ISO date strings → DateTime, null → Type? (optional), nested objects → Json, arrays → Json.

Can I use the generated schema directly?

Yes, the output is valid Prisma schema syntax. Save it as schema.prisma and run npx prisma generate to create the Prisma Client for your project.

Is my data sent to a server?

No, all processing happens entirely in your browser. Your JSON data never leaves your device.

Related Tools