JSON to TypeScript
Paste any JSON and instantly generate strongly typed TypeScript interfaces, with nested objects detected and named after their keys. Great for typing API responses and fixtures. Runs entirely in your browser.
About JSON to TypeScript
Generates strongly typed interfaces from sample JSON, detecting nested objects and arrays and naming them after their keys. Validate and beautify the source first with theJSON Formatter, or convert the same payload to other languages withJSON to Go andJSON to C#.
Secure & Private Client-Side
This tool runs entirely in your browser. No data is sent to any server, ensuring your information remains private and secure.
About JSON to TypeScript
Paste any JSON and instantly generate strongly typed TypeScript interfaces, with nested objects detected and named after their keys. Great for typing API responses and fixtures. Runs entirely in your browser.
Frequently Asked Questions
How are nested objects named? expand_more
Each nested object becomes its own interface, named after its key in PascalCase. You can override the root interface name in the input field.
How are arrays handled? expand_more
Arrays are emitted as Type[], with the item type inferred from the first element. Empty arrays fall back to unknown[] for safety.
Are reserved words handled? expand_more
Yes. Reserved TypeScript keywords and invalid identifiers are quoted automatically so the output compiles without manual edits.
Can I generate types for other languages? expand_more
Yes. Use [JSON to Go](/tools/json-to-go/) for Go structs or [JSON to C#](/tools/json-to-csharp/) for C# classes.
Is my JSON uploaded anywhere? expand_more
No. All parsing and code generation happens locally in your browser.
Common Use Cases
- API Clients: Generate TypeScript interfaces from a sample API response before writing fetch calls.
- Migration: Move a JavaScript codebase to TypeScript by deriving types from existing JSON fixtures.
- Mock Servers: Hand the generated interfaces to your team so frontend and backend agree on shape.
- Documentation: Publish typed examples alongside your REST or GraphQL endpoints.