JSON to Prisma Schema Generator

Generate Prisma ORM models from JSON data. Auto-detect types, @id, @unique, and timestamps.

JSON Input

Loading...

Prisma Schema

Loading...

About JSON to Prisma Schema Generator

Prisma is the leading type-safe ORM for Node.js and TypeScript, supporting PostgreSQL, MySQL, SQLite, MongoDB, and CockroachDB. Our JSON to Prisma converter analyzes your JSON data and generates a complete Prisma schema with proper scalar types, @id decorators, @unique hints for email-like fields, and timestamp detection — letting you go from an API response or mock data to a fully scaffolded database model in seconds. The output includes generator and datasource blocks, so you can run prisma generate immediately.

How to Use JSON to Prisma Schema Generator

1

Paste Your JSON Data

Paste a JSON object (or array of objects) into the input editor. Each top-level key becomes a model field. Arrays of objects use the first element to infer the schema.

2

Review the Generated Schema

The tool outputs a complete schema.prisma file with inferred types, @id on id-like fields, @unique on email fields, and @default(now()) on timestamp fields. Review and adjust as needed.

3

Copy or Download

Copy the schema to your clipboard or download it as a schema.prisma file. Paste it into your project and run npx prisma generate to scaffold your database client.

Common Use Cases

Bootstrap Database Schema

Paste an API response or mock data and instantly generate Prisma models to bootstrap your database. Run prisma migrate dev to create tables that match your data shape without writing SQL.

Rapid Prototyping

Convert JSON fixtures or seed data into Prisma models for quick prototype database setup. Iterate on your data model by modifying the JSON and regenerating the schema.

API-to-Database Mapping

Generate Prisma models that mirror your REST or GraphQL API payloads, ensuring a clean mapping between your API layer and database layer without manual type translation.

Migration Planning

When migrating from a NoSQL database (MongoDB, Firebase) to a relational database, paste document samples to generate Prisma models as a starting point for your new schema.

Team Onboarding

New team members can paste API responses to understand the database structure. The generated Prisma schema serves as readable documentation of field types, relationships, and constraints.

Why Use Our JSON to Prisma Schema Generator?

Smart Type Detection

Infers String, Int, Float, Boolean, DateTime (from ISO date strings), and Json (for nested objects) automatically from your JSON values

Decorator Hints

Auto-adds @id on id fields, @unique on email-like fields, @default(now()) and @updatedAt on timestamp fields, saving manual annotation work

Complete Schema Output

Includes generator (prisma-client-js) and datasource (PostgreSQL) blocks so the output is ready for prisma generate without any boilerplate

Database Agnostic

The generated schema defaults to PostgreSQL but works with MySQL, SQLite, MongoDB, and CockroachDB by changing one line in the datasource block

Instant & Private

All processing happens in your browser. Your data never leaves your device, making it safe for production schemas with sensitive field names

One-Click Export

Copy to clipboard or download as schema.prisma for immediate use in your Prisma project

Key Features

Auto-detect String, Int, Float, Boolean, DateTime, and Json Prisma types from JSON values

Smart @id decorator on id-like fields

@unique hint on email and username fields

Timestamp detection with @default(now()) and @updatedAt

Complete schema with generator and datasource configuration blocks

Configurable model name

Handles arrays of objects (uses first element for type inference)

Optional fields (Type?) for null JSON values

Copy to clipboard and download as schema.prisma

100% client-side processing — no data leaves your browser

100% Client-Side Processing

Your data never leaves your browser

No Server UploadJSON processed locally
Works OfflinePWA installed
100% PrivateZero data collection

All processing happens in your browser using JavaScript. Your data is never sent to our servers or any third party. Safe for sensitive data, API keys, and production configs.

Frequently Asked Questions

Quick answers to common questions about json to prisma schema generator


The generator maps JSON values to Prisma scalar types: strings become String, integers become Int, decimals become Float, booleans become Boolean, ISO date strings (e.g., "2024-01-15T10:30:00Z") become DateTime, and nested objects or arrays become Json. Null values produce optional fields marked with String? (or the appropriate nullable type).


Currently the tool generates flat models with Json type for nested objects. For relational schemas, you would manually split nested objects into separate models and add @relation decorators. This is intentional — relation design requires understanding your domain, which automated tools cannot infer from a single JSON sample.


The generated schema defaults to PostgreSQL but works with any Prisma-supported database. Simply change the provider in the datasource block to "mysql", "sqlite", "mongodb", or "cockroachdb". The scalar types are compatible across all providers.


Fields named "id" are automatically annotated with @id. Fields named "email" or containing "email" in their name receive @unique. Fields named "createdAt" or "created_at" get @default(now()), and "updatedAt" or "updated_at" get @updatedAt. You can adjust these decorators after generation.


If your JSON is an array of objects, the tool uses the first element to infer a single model definition. All unique keys across the first element become fields. For multiple different models, paste each JSON shape separately.


Yes. The generated schema includes all required blocks (generator and datasource). After pasting it into your schema.prisma file and configuring your DATABASE_URL, you can run npx prisma migrate dev to create the database tables.


JSON arrays in your input data are mapped to the Json Prisma type, which stores them as native JSON in PostgreSQL (jsonb column), MySQL (json column), or as a text string in SQLite. If you need a normalized structure, manually convert the Json field to a separate related model.