Paste any JSON object and instantly get a fully-typed TypeScript interface. Supports nested structures, arrays, optional fields, and custom naming. Everything runs in your browser — nothing leaves your machine.
TypeScript's type system is one of its greatest strengths — it catches type errors at compile time, improves IDE auto-completion, and documents your data structures as code. When working with REST APIs, configuration files, or database schemas, you typically receive JSON at runtime. Defining TypeScript interfaces for that JSON means every field access is validated by the compiler, refactors are safe, and future developers (including you, six months from now) immediately understand what data a function expects.
Manually writing interfaces for complex, deeply nested JSON objects is tedious and error-prone. This tool analyses your JSON's structure, infers the correct TypeScript types for each field (string, number, boolean, null, arrays, or nested objects), and emits clean, ready-to-paste TypeScript — in seconds.
string, number, boolean, null
T[] with inferred item type
unknown[] / Record<string, unknown>
.ts
interface vs typeinterface — preferred for object shapes, supports declaration merging
type — more flexible, supports unions & intersections
interface for API response shapes
? to all properties
key?: string instead of key: string
null-valued fields automatically get T | null type
zod or io-ts
JSON.parse with a type cast: JSON.parse(data) as Root
openapi-typescript
The converter walks the parsed JSON tree recursively. Each value's JavaScript typeof result maps to a TypeScript type: "string" → string, "number" → number, "boolean" → boolean. A null value becomes T | null (or just null if no other samples exist). Arrays are inspected for their element types — if all items share the same shape, the item type is inferred; mixed-type arrays fall back to unknown[].
Nested objects generate separate named interfaces. The name is derived from the parent key in PascalCase — so a JSON field "userProfile" produces an interface named UserProfile. The root interface uses whatever name you enter in the Root name field, defaulting to Root. All sub-interfaces are emitted in dependency order so the output is copy-paste ready without any reordering.