JSON to TypeScript
JSON to TypeScript converts JSON samples into TypeScript interfaces and type aliases, with inferred optional fields, unions, and array item structure for API modeling, frontend bootstrapping, and mock data cleanup.
JSON
Character
0 / 500,000
TypeScript
Quick Start
Common Scenarios
Turn real API responses into TypeScript types you can use immediately in frontend pages, SDK clients, or integration tests.
Before formalizing an API contract, inspect how optional fields, null values, and union types are inferred from real JSON samples.
Convert mock JSON data into quick type definitions for fixtures, Storybook stories, or prototypes.
When backend payloads change, use the latest JSON sample to review whether nested declarations like User or Meta also need updates.
Usage Advice
Limitations & Compatibility
Privacy & Security
FAQ
Object roots generate interface declarations. Array and primitive roots generate type aliases. For a top-level object array, the root stays a type alias such as type Root = RootItem[];, and the item structure is declared separately.
With no sample items or properties, the generator cannot infer anything narrower. It keeps empty arrays as unknown[] and empty objects as interfaces extending Record<string, unknown> until you paste more representative data.
If the name you enter is already a valid TypeScript identifier, it is preserved exactly, for example APIResponse. Invalid names are normalized into a stable PascalCase identifier before generation.
The current generator normalizes nested names from property paths and resolves collisions deterministically. That is why newer output uses names such as User, Meta, or FooBarClass instead of always prefixing them with the root name.
The current output contract intentionally returns plain declarations without export. This keeps the output neutral, and you can add export yourself to match your project style.