Convert Tools

JSON to Prisma Schema Generator

Turn sample JSON into ready-to-edit Prisma model drafts — with scalar types, Int/Float/DateTime detection, and relations for nested objects and arrays. Perfect for prototyping a database schema.

JSON Input

Paste a sample object or an array of objects.

Generated Prisma Schema

Copy into your schema.prisma file.

// Your generated Prisma schema will appear here

What this tool generates

  • • Prisma model blocks for objects
  • • Int, Float, Boolean, String & DateTime fields
  • • Relations for nested objects and arrays
  • • An optional generator & datasource block

Good use cases

  • • Bootstrapping a database schema from API data
  • • Prototyping app data models quickly
  • • Migrating JSON fixtures into a relational model
  • • Drafting models before refining migrations

Privacy

Everything runs locally in your browser. Your JSON is never uploaded to a server, so it is safe to use with internal data.

What Is a JSON to Prisma Schema Generator?

A JSON to Prisma schema generator automatically converts a sample JSON payload into Prisma schema model definitions — the data model language used by the Prisma ORM for Node.js and TypeScript. Instead of hand-writing model blocks, scalar field types, and relation fields, you paste real JSON and the tool infers a complete draft schema in milliseconds.

The generator inspects each value to pick a Prisma scalar type — Int or Float for numbers, Boolean, String, and DateTime for ISO date strings. Nested objects become separate related models with one-to-one relations, and arrays of objects become one-to-many relations complete with the relation scalar foreign keys Prisma requires.

The output is a starting point for prototyping — review optional fields, indexes, and relation directions before running prisma migrate. Everything is computed locally in your browser, so no JSON ever leaves your machine.

How to Convert JSON to a Prisma Schema

  1. 1 Paste your JSON — drop a sample object or an array of objects into the left panel. Click Sample to load an example first if you want to see the output shape.
  2. 2 Name the root model — enter a name such as User or Order. This becomes the top-level Prisma model; nested objects and arrays are named automatically from their keys.
  3. 3 Pick your database provider — choose PostgreSQL, MySQL, SQLite, MongoDB, or SQL Server. This sets the datasource provider and warns you when a feature (like scalar list fields) is unsupported on that database.
  4. 4 Tune the options — keep "Add id field" on so every model has a primary key, enable DateTime detection for ISO date strings, and toggle the generator & datasource blocks depending on whether you are pasting into a fresh or existing schema.
  5. 5 Copy or download — the right panel updates live. Click Copy to grab the schema, or Download to save a schema.prisma file, then run npx prisma format and npx prisma migrate dev.

Common Use Cases

Bootstrapping a schema from an API

Paste a real REST or GraphQL response and instantly get a relational draft. It is the fastest way to turn an external payload into a database model you can iterate on.

Prototyping a new app

When sketching a side project, mock up the JSON shape of your entities and generate the Prisma models in one step instead of typing every field by hand.

Migrating JSON fixtures to a database

Have seed data or fixtures stored as JSON? Generate models that match their structure so you can load the data into PostgreSQL, MySQL, or SQLite with Prisma.

Learning Prisma syntax

See how nested objects map to relations, how arrays become one-to-many links, and how foreign keys are wired — a quick, hands-on way to understand the Prisma schema language.

Drafting models for a team review

Produce a readable schema draft from a sample payload to share in a design discussion before anyone commits to migrations or relation directions.

Documentation and examples

Generate clean Prisma snippets from example JSON for tutorials, blog posts, or internal docs without crafting the syntax manually.

Frequently Asked Questions

How are nested objects and arrays handled?

A nested object becomes its own model linked by a one-to-one relation, and an array of objects becomes a separate model joined by a one-to-many relation. The tool adds the relation field, the relation scalar foreign key, and the back-relation field that Prisma requires on both sides.

How does it decide between Int and Float?

Whole numbers map to Int and numbers with a decimal point map to Float. If a field is sometimes whole and sometimes fractional in your real data, change it to Float (or Decimal) after generating.

Does it detect dates?

Yes. When "Detect DateTime from ISO strings" is enabled, strings that match an ISO 8601 date or date-time pattern (for example 2024-01-15T10:30:00Z) are typed as DateTime. Turn the option off to keep them as plain String fields.

What happens with null values and missing keys?

A null value cannot be typed, so the field is marked optional and defaults to String? — adjust the type to match your real data. When you paste an array of objects, any key missing from some items is also marked optional.

Why do scalar arrays only work on some databases?

Prisma supports scalar list fields like String[] only on PostgreSQL and MongoDB. If you select MySQL, SQLite, or SQL Server, the tool adds a note suggesting you model those values as a related table instead.

Is the generated schema ready for production?

Treat it as a draft. JSON is a single snapshot, so review optional fields, add indexes and unique constraints, confirm relation directions, and run npx prisma format before generating migrations.

Is my JSON data sent to a server?

No. All parsing and schema generation runs locally in your browser with JavaScript. Nothing is uploaded, so you can safely use confidential or proprietary payloads.