JSON to Prisma Schema

JSON Tools

How to use the JSON to Prisma Schema

Generate Prisma schema in one step:

1

Paste your JSON object

Paste a single JSON object representing one database record.

2

Set the model name

Enter the Prisma model name (e.g. User, Post, Product).

3

Click Generate

Get a Prisma model definition with correct field types and an auto-generated id field.

4

Add relations manually

Copy into your schema.prisma file and add relations, indexes, and constraints as needed.


When to use this tool

Use this when scaffolding a Prisma database schema from existing JSON data:

  • Starting a new project and converting your API response shapes to Prisma models
  • Scaffolding database models from existing JSON data before adding relations
  • Quickly prototyping a Prisma schema without writing boilerplate manually
  • Converting JSON API documentation into a Prisma schema draft

Frequently asked questions

Q:How are JSON types mapped to Prisma field types?
Strings become String, numbers become Int or Float, booleans become Boolean, null values become optional fields (marked with ?), ISO date strings become DateTime, and nested objects or arrays become Json.
Q:Does it generate relations?
No — relations between models require domain knowledge the tool doesn't have. It generates a flat model for your object and maps nested objects and arrays to the Json type instead.
Q:Is the generated schema production-ready?
It's a solid starting scaffold. Common attributes like @id, @unique on email fields, @default(now()) on createdAt, and @updatedAt are auto-applied. You'll still need to add relations, indexes, and any custom constraints before shipping to production.
Q:Can I use this with any database Prisma supports?
Yes — the generated schema is standard Prisma syntax and works with any Prisma-supported database including PostgreSQL, MySQL, SQLite, MongoDB, and SQL Server. Just set your datasource provider in schema.prisma accordingly.
Q:What happens if my JSON has nested objects or arrays?
Nested objects and arrays are mapped to the Prisma Json type. If you need them as separate related models, you'll need to extract them manually and add the appropriate relation fields.