What is JSON → Prisma Schema?
Generate a Prisma schema from JSON. Paste a JSON object or an array of objects and get Prisma models with field types, optional fields, an @id, and relations, ready to drop into schema.prisma.
Nested objects become one-to-one relations and arrays of objects become one-to-many relations, each with a foreign key field, @relation and onDelete: Cascade. Prefer to keep nested data together? Switch the setting to Json fields instead.
Choose PostgreSQL, MySQL or SQLite and the output adapts: @db.Uuid, @db.Date and @db.Timestamptz on PostgreSQL, scalar lists like String[] where they are supported, @db.Text for long MySQL strings, and text-based JSON on SQLite. Field names are camelCase, with @map and @@map keeping snake_case names in the database.
Everything runs in your browser, so your sample data never leaves your machine.
Features
- Prisma models with Int, BigInt, Float, Boolean, String, DateTime and Json fields
- Optional fields (?) for keys that are missing or null in some records
- Reuses a unique id field as @id, or adds @id @default(autoincrement())
- One-to-one and one-to-many relations from nested objects and arrays
- Provider-aware native types for PostgreSQL, MySQL and SQLite
- camelCase fields with @map / @@map to snake_case database names
- Optional generator and datasource blocks
- 100% client-side: nothing is uploaded
How to use JSON → Prisma Schema
- Paste your JSON. Enter a JSON object or an array of objects that represents your data.
- Pick the database. Open Settings to choose PostgreSQL, MySQL or SQLite, name the root model, and choose related models or Json fields for nested data.
- Copy into schema.prisma. Copy or download the models, add them to your schema.prisma, then run prisma migrate dev or prisma db push.
Examples
Nested JSON to related Prisma models
PostgreSQL provider, root model named User, generator and datasource blocks turned off.
Input
[
{
"id": 1,
"name": "Ada",
"email": "ada@example.com",
"signedUpAt": "2026-01-02T10:00:00Z",
"address": {
"city": "London"
},
"orders": [
{
"sku": "A1",
"qty": 2
}
]
}
]Output
model User {
id Int @id
name String
email String
signedUpAt DateTime @db.Timestamptz(3) @map("signed_up_at")
address Address?
orders Order[]
@@map("user")
}
model Address {
id Int @id @default(autoincrement())
userId Int @unique @map("user_id")
city String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@map("address")
}
model Order {
id Int @id @default(autoincrement())
userId Int @map("user_id")
sku String
qty Int
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@map("orders")
}SQLite with Json fields
With nested data stored as Json fields on SQLite, values are kept as text.
Input
[
{
"id": 1,
"name": "Ada",
"email": "ada@example.com",
"signedUpAt": "2026-01-02T10:00:00Z",
"address": {
"city": "London"
},
"orders": [
{
"sku": "A1",
"qty": 2
}
]
}
]Output
model User {
id Int @id
name String
email String
signedUpAt DateTime @map("signed_up_at")
/// JSON stored as text
address String
/// JSON stored as text
orders String
@@map("user")
}Frequently asked questions
How do I generate a Prisma schema from JSON?
Paste the JSON into the input editor. The tool infers a model for the root object and for each nested object or array of objects, with field types, optional fields and relations. Copy the result into schema.prisma.
How are nested objects turned into relations?
A nested object becomes a separate model with a @unique foreign key back to its parent (one-to-one). An array of objects becomes a model with a plain foreign key (one-to-many), and the parent gets a list field such as orders Order[].
Does it work with MySQL and SQLite?
Yes. Pick the provider in Settings. Scalar lists such as String[] are only used on PostgreSQL. On MySQL lists become Json, and on SQLite JSON data is stored as String.
Why are there @map and @@map attributes?
Prisma fields are usually camelCase while database columns are often snake_case. @map and @@map keep both conventions. Turn the option off if you want the database to use the Prisma names directly.
Which Prisma version is the output for?
The models use standard Prisma schema syntax. In Prisma 7 and later the database URL is configured in prisma.config.ts rather than in the datasource block, as the generated comment notes.
Is my data uploaded?
No. The schema is generated entirely in your browser.
