About JSON to TypeScript
Writing interfaces by hand for a large API response is slow and easy to get wrong: one missed nested object, one array of mixed values and the type stops matching the payload. This generator reads the JSON, infers a type for every value and prints named interfaces for the nested objects, so the result can be pasted straight into a TypeScript project.
Arrays of objects are merged into a single shape, with a property marked optional when it does not appear on every element. Identical shapes share one interface instead of repeating it under different names, and property names that are not valid identifiers are quoted while interface names are converted to PascalCase. Generation happens in the tab, so the payload is never uploaded.
What this tool does
Interfaces from real JSON
Every object in the payload becomes an interface, and the root gets a named export type you can import anywhere.
Arrays merged into one shape
Elements of an array of objects are combined, and keys missing from some elements become optional properties.
Nested shapes named
Nested objects receive PascalCase names derived from their key or path, instead of anonymous inline types in the output.
Deduplicated interfaces
Structurally identical objects reuse a single interface name, so the generated file stays short and readable.
Safe identifiers
Property names with spaces, dashes or leading digits are quoted, and interface names are sanitized to valid TypeScript identifiers.
Copy and download, no upload
Copy the TypeScript or download it as a .ts file; the JSON stays on your device and the tool works offline.
How to use JSON to TypeScript
- 01
Paste the JSON
Paste an API response or load a .json file from your device, up to 10 MB.
- 02
Name the root type
Set the root name, such as User or ApiResponse. The generator uses it for the first interface and derived names for nested shapes.
- 03
Generate the types
Press Generate. The JSON is parsed, shapes are inferred and merged, and interfaces are printed in the output pane.
- 04
Review names and optional fields
Check the derived interface names and the optional properties, since they come from this sample payload only.
- 05
Copy or download the file
Copy the types into your editor or download a .ts file you can drop into the project.
Supported formats and limits
- Input
- JSON
- Output
- TypeScript
- Processing
- Client-side, in your browser. Nothing is uploaded.
- Maximum size
- Bound by the memory available to your browser tab.
- Requirements
- Chrome, Edge, Firefox or Safari · JavaScript enabled
Limitations worth knowing
- Types are inferred from this sample only: fields missing from the payload never appear, and their optionality cannot be known.
- No runtime validation, schema, tuple or branded types are generated; the output is plain interfaces and type aliases.
- Empty arrays become unknown[] and empty objects become Record<string, never>, because the sample carries no element information.
- Input is capped at 10 MB of JSON and generation runs on the main thread after a short yield.
Privacy and file handling
Your JSON is parsed and converted to TypeScript entirely inside this browser tab with JavaScript. The payload is never uploaded to FormatFlow or anyone else, no copy is stored and nothing leaves your device; closing the page clears the input and the generated types.
Read the full privacy policy
