JSON to Prisma Schema Model Generator
Convert JSON to Prisma schema models online. Infers Int, String, Boolean and DateTime columns, marks @id primary keys and optional fields. Free, no upload.
Prisma schema will appear here…
To turn JSON into a Prisma model, paste a representative record on the left. Each property is mapped to a Prisma scalar type such as Int, String, Boolean or DateTime, an id field becomes @id @default, and the right pane returns a block you can paste into schema.prisma.
A Prisma model declares a table in schema.prisma, and Prisma generates a typed client and migrations from it. JSON2X infers a model from a sample record: each key becomes a field with a Prisma scalar type such as Int, String, Boolean, Float, or DateTime, an id key is annotated @id, and keys absent from some records become optional with ?.
How are Prisma scalar types inferred?
From the JSON values, with one wrinkle: JSON has a single numeric type, so a whole number becomes Int and a fractional one becomes Float. That is a guess, and it is the field most often wrong — an amount that happens to be 100 in your sample will reject 100.5 later, and money is better modelled as Decimal than Float in any case. Strings matching ISO 8601 become DateTime; everything else is String. Review the numeric fields before you migrate.
What about relations and nested objects?
Prisma models are relational, so a nested object is really a hint that a second model and a relation belong there. Inference cannot make that call — it does not know whether author is an embedded value or a foreign key — so nested structures are emitted as Json fields, which PostgreSQL and MySQL both support. Where the nesting is genuinely a relationship, split it into a second model and add matching @relation fields on both sides; Prisma will then generate the join for you.
Is the generated schema ready to migrate?
It will migrate, but review it first, because prisma migrate is how the schema reaches a real database. Inference produces no @unique constraints, no indexes on foreign keys, no explicit @db length annotations, and no cascade rules. It also cannot know your primary key strategy — whether @default(autoincrement()), @default(cuid()), or @default(uuid()) is right for you. Run the first migration against a development database, never production.
How to use the JSON to Prisma
Takes under a minute. Nothing is uploaded — every step runs in this browser tab.
- Paste a representative record
Put one object — or an array of them — into the left-hand input pane. An array lets the generator work out which fields are optional.
- Name the model
Set the model name in PascalCase singular, which is the Prisma convention: `User`, not `users`.
- Read the generated model
The right-hand pane shows a model block with typed fields, an @id on the primary key, and @default(now()) on timestamp-looking fields.
- Add relations, then migrate
Wire up relation fields by hand, then run `prisma migrate dev` against a development database.
When to use it
- Bootstrapping a Prisma schema from an existing API response or JSON export
- Migrating documents out of MongoDB or Firestore into Postgres with Prisma
- Drafting a model for a new feature from a sample payload
- Turning a JSON seed file into a schema plus a typed seed script
- Getting a typed database client over data that arrived as JSON
Step-by-step guides for this tool
Task-specific walkthroughs covering the most common ways this tool gets used.
Searches this page answers
- json to prisma schema online
- free json to prisma converter
- prisma schema generator online
- prisma model generator from json
- generate schema.prisma from json
- json to prisma orm
- prisma schema from api response
Frequently Asked Questions
How does JSON to Prisma conversion work?
The generator inspects your JSON entity properties and produces valid Prisma schema.prisma model declarations.
Which Prisma scalar types are inferred?
Int and Float for numbers, String for text, Boolean for true/false, and DateTime for values that parse as timestamps. Nulls in the sample produce optional fields marked with ?.
Does it add an @id primary key?
Yes, when the add-id option is on: an existing id field is annotated as the @id, and if none exists one is added. Turn it off when the model is a relation table you will key differently.
Can it emit the datasource and generator blocks too?
Yes. Enable the datasource option and the output includes the datasource db and generator client blocks, so the result is a schema.prisma file you can run prisma generate against rather than a bare model.
Is this Prisma schema generator free, and is my JSON uploaded?
It is free with no account, and nothing is uploaded — the model is built in your browser from the JSON you paste.
Related Developer Tools
- Standards & references:
- Prisma ORM
- JSON
Last reviewed by the JSON2X Engineering Team.