JSON → TypeScript / Zod / Prisma
Generate TypeScript interfaces, Zod schemas and Prisma models from JSON.
// Paste JSON to generate
How it works
1. Paste your JSON — Enter a JSON object or array in the input area. The tool parses it and infers the structure.
2. Choose output format — Select TypeScript, Zod, or Prisma from the tabs. Each generates code appropriate for that use case.
3. Review the generated code — The tool shows the interface, schema, or model with proper types and optional/nullable handling.
4. Copy to clipboard — Click the copy button to get the code ready for your project.
5. Refine as needed — The generated code is a starting point. Review and adjust types, add validation rules, or modify field names.
Examples
Example 1: User profile API response
{"id": 123, "name": "Jane Doe", "email": "jane@example.com", "isActive": true, "roles": ["admin", "editor"]}
TypeScript output:
interface User {
id: number;
name: string;
email: string;
isActive: boolean;
roles: string[];
}
Example 2: Zod schema for validation
Same JSON generates a Zod schema you can use for runtime validation:
const UserSchema = z.object({
id: z.number(),
name: z.string(),
email: z.string(),
isActive: z.boolean(),
roles: z.array(z.string())
});
Example 3: Prisma model
The Prisma tab generates a model suitable for your schema.prisma file:
model User {
id Int
name String
email String
isActive Boolean
roles String[]
}Frequently asked questions
Does this handle nested objects?
Yes — nested objects are converted to separate interfaces (TypeScript) or inline objects (Zod). The tool recursively processes the entire JSON structure.
What about arrays?
Arrays are typed based on their contents. If an array contains mixed types, the tool uses union types (e.g., string | number).
Can I generate from a JSON array?
Yes — the tool analyzes all items in the array and creates a type that covers all properties found across the items.
Does it handle null values?
Yes — null values result in nullable or optional types. In TypeScript, you might see field?: string or field: string | null.
Is the generated code production-ready?
It's a solid starting point, but you should review it. The tool infers types from example data, which may not cover all edge cases. Add validation, constraints, and adjust types as needed.
Can I convert JSON Schema to TypeScript?
This tool converts JSON data (instances) to types. For JSON Schema (the specification format), you need a different tool like json-schema-to-typescript.
Does my JSON leave my browser?
No. All processing happens locally in your browser. Your data is never sent to any server.