Home → JSON to Prisma Schema Generator

JSON to Prisma Schema Generator

Generate Prisma ORM model definitions from any JSON object.

About This Tool

Generate Prisma ORM model definitions 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.

What Prisma Schema Is

Prisma schema is the single source of truth for your database model in Prisma ORM, describing models, fields, types, and relations.

Prisma Data Models

Each model block maps to a database table. Fields have Prisma scalar types (String, Int, Float, Boolean, DateTime, Json) and optional attributes (@id, @unique, @default). The schema drives both database migrations and the generated TypeScript client.

Prisma Relations

One-to-one, one-to-many, and many-to-many relations are defined with @relation decorators. Prisma uses the relation to generate typed query methods (include, select, connect) in the client.

From JSON to Prisma Models

The converter infers a complete Prisma model definition from your JSON sample, including field types and nested relations.

Type Mapping

JSON string → String, number → Int or Float, boolean → Boolean, object → related model with @relation, array of objects → one-to-many relation. Date strings are mapped to DateTime when they match ISO 8601 format.

ID and Timestamps

The tool adds an id Int @id @default(autoincrement()) field following Prisma convention, and optional createdAt DateTime @default(now()) and updatedAt DateTime @updatedAt fields for audit tracking.

Frequently Asked Questions

What is Prisma schema?+
Prisma schema (schema.prisma) is a file that defines your database models, relations, and data source configuration for Prisma ORM. Each model block corresponds to a database table, with fields mapping to columns. Prisma uses this schema to generate a type-safe client, run migrations, and introspect existing databases.
How does JSON to Prisma conversion work?+
The tool analyzes your JSON object and infers a Prisma model: string values become String fields, integers become Int, decimals become Float, booleans become Boolean, nested objects become related models connected via @relation, and arrays of objects become one-to-many relations.
Does the generated Prisma schema include relations?+
Yes. Nested JSON objects are converted to separate Prisma models with proper @relation fields. For example, a user object containing an address object produces a User model and an Address model, with User having an address Address? field and Address having a userId field with the @relation annotation.
Can I use the generated Prisma schema directly?+
The generated schema is a solid starting point. Review it to choose appropriate field types, add @unique constraints, set required vs optional fields (? suffix), and verify that relation names make semantic sense. Run prisma migrate dev after reviewing the schema.

JSON to Prisma Schema Conversion

Prisma is a modern TypeScript ORM for Node.js and TypeScript. Its schema language defines database models with field types, relations, and constraints.

JSON Input → Prisma Model

// JSON Sample
{
  "id": 1,
  "name": "Alice",
  "email": "alice@example.com",
  "age": 30,
  "isActive": true,
  "createdAt": "2024-01-01T00:00:00Z"
}

// Prisma Schema
model User {
  id        Int      @id @default(autoincrement())
  name      String
  email     String   @unique
  age       Int?
  isActive  Boolean  @default(true)
  createdAt DateTime @default(now())

  @@map("users")
}

// datasource + generator
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

Prisma Field Types

JSON TypePrisma TypeNotes
stringString
integerIntor BigInt for large numbers
floatFloator Decimal for precision
booleanBoolean
date stringDateTime
nullableType?Add ? for optional fields
arrayType[]Requires list relation
JSON blobJsonPostgreSQL native JSON

Explore more tools: All JSON Tools | Validator | Pretty Print | JSON Diff