JSON to Prisma Schema

FreePrivateInstant
JSON input
Prisma model
Ctrl+Enter Generate Model

JSON to Prisma Schema Generator

Paste a JSON object and get a Prisma model block with inferred field types. Handles strings, integers, floats, booleans, ISO date strings (typed as DateTime), and nested objects (typed as Json). Auto-detects the @id field and adds one if missing. Runs entirely in your browser.

Where Is This Useful?

Scaffolding new database models
Starting a new Next.js or Express app with Prisma and PostgreSQL? Paste your data structure as JSON and get the Prisma model block to paste into schema.prisma in seconds.
Migrating from MongoDB or NoSQL
Moving a MongoDB collection to a relational database? Export a sample document and paste it here to get the relational Prisma model as a starting point for your migration schema.
API response modeling
When you need to persist data from an external API to your database, paste the API response here to get a Prisma model that matches the shape, then add relations and constraints as needed.

How to Use

  1. Paste a JSON object in the input panel (not an array — Prisma models describe one record)
  2. Set the model name (defaults to Model)
  3. Click Generate Model or press Ctrl+Enter
  4. Copy and paste the model block into your schema.prisma file
  5. Add @unique, @default, relations, and other attributes as needed

Type Mapping

  • JSON string → String
  • ISO date string → DateTime
  • JSON integer → Int
  • JSON float → Float
  • JSON boolean → Boolean
  • JSON null → String? (nullable)
  • JSON object or array → Json
  • id or _id field → annotated with @id

Frequently Asked Questions

What Prisma types does this tool generate?

It generates String, Int, Float, Boolean, DateTime, and Json. Strings matching ISO date patterns are typed as DateTime.

Does it detect the @id field?

Yes. If your JSON has an id or _id field, it gets the @id attribute. If no id field is present, an auto-incremented id Int @id @default(autoincrement()) is added.

Is the output ready to paste into schema.prisma?

The model block is ready to paste. You still need datasource and generator blocks at the top of your schema file if you don't have them yet.

How is this different from JSON to Mongoose?

Mongoose is for MongoDB with Node.js and generates JavaScript schema code. Prisma is a modern ORM targeting SQL databases (PostgreSQL, MySQL, SQLite) and generates a declarative schema file.

Is my JSON uploaded anywhere?

No. Everything runs locally in your browser. Your data never leaves your machine.

Related Tools