How to use the JSON to Prisma Schema Generator
- Paste JSON into the left box, or click Load sample.
- Set the Root model name and pick your Database.
- Check the generated models: rename fields, add
@uniqueor@defaultwhere you need them. - Click Copy, paste into
prisma/schema.prisma, and runnpx prisma migrate dev. On Prisma 7, set the database URL inprisma.config.tsfirst.
How JSON maps to Prisma
| JSON | Prisma |
|---|---|
| Whole number | Int (or BigInt beyond 2,147,483,647) |
| Decimal number | Float (switch to Decimal for money) |
| true / false | Boolean |
ISO date string, e.g. "2026-10-24T09:30:00Z" | DateTime |
| Other strings | String |
| Nested object | A related model, one-to-one, with a @unique foreign key |
| Array of objects | A related model, one-to-many, with the foreign key on the child |
| Array of strings or numbers | String[] / Int[] on PostgreSQL, Json on MySQL and SQLite |
| null, or missing in some items | An optional field (?) |
IDs
A key called id becomes the primary key: Int @id @default(autoincrement()) for numbers, String @id @default(uuid()) for UUIDs. Models without an id get one added, because every Prisma model needs a unique identifier. Keys that aren't valid Prisma field names (like first-name) are renamed to camelCase and keep the original column name with @map.
Prisma 7 or Prisma 6?
Prisma 7 moved the database connection URL out of schema.prisma into a prisma.config.ts file, and uses the new prisma-client generator, which writes the client into your source folder. Pick 7 for new projects. Pick 6 if your project still has url = env("DATABASE_URL") in its schema and imports from @prisma/client. The models themselves are the same in both.
Review before you migrate
JSON doesn't say which fields should be unique, indexed or required, or whether a nested object is really shared between records. Treat the output as a solid first draft: check relations, add @unique to things like emails, and use Decimal for prices. On MySQL with relationMode = "prisma", an @@index on each foreign key is added for you.
Frequently asked questions
Does it support MongoDB?
Not yet. MongoDB models use @db.ObjectId ids and embedded types, which work differently. Choose PostgreSQL, MySQL or SQLite.
Why did a list become Json?
Scalar lists like String[] are only supported on PostgreSQL (and CockroachDB). On MySQL and SQLite they're stored as Json.
Can I get TypeScript types instead?
Yes, use JSON to TypeScript, or JSON to Zod for runtime validation. Prisma also generates types from your schema when you run prisma generate.
Is my data uploaded?
No. The models are generated in your browser.
Updated