Advertisement

JSON to Prisma Schema

Convert JSON into Prisma models. Scalar fields get native types, optional fields get ?, and complex values map to Json for flexibility.

JSON input

Paste JSON, optionally name the root type, then generate.

Your Prisma model code will appear here.
Advertisement

From JSON sample to database table

Prisma schemas are usually written by hand from domain knowledge. When you already have representative JSON, this tool drafts the model for you: scalars get native types, shaky fields become optional, and nested structures land in Json columns.

Review before migrating

Treat the output as a starting draft. Confirm the id strategy, decide which Json fields deserve real relations, then run prisma migrate to create the table.

JSON to Prisma FAQs

What is a Prisma model?
A Prisma model maps to a database table: each field becomes a column with a type. Prisma Client then gives you type safe queries generated from the schema.
Why is there an id field?
Prisma models need a unique identifier. The generator adds id String @id @default(cuid()); remove or change it if your table uses a different key strategy.
How are nested objects handled?
Prisma is relational, not document based, so nested objects and arrays become Json fields. If you need relations, split them into separate models manually.
What does the ? mean?
A ? marks an optional field that maps to a nullable column, used for values that were null or missing in the sample.
Which databases does this work with?
The scalar types used (String, Int, Float, Boolean, Json) work across PostgreSQL, MySQL, SQLite, and MongoDB with Prisma.
Advertisement