JSON to TypeScript Converter
Paste JSON, get TypeScript interfaces instantly. 100% in your browser — data never leaves the page. interface or type, nested objects, arrays, optional fields. Free, no sign-up.
Options
Built and reviewed by developers who work with typed APIs daily.
What is JSON to TypeScript conversion?
JSON to TypeScript conversion reads a JSON value and generates matching TypeScript interface or type definitions — eliminating hand-written boilerplate for API responses and config files. Paste a payload and get production-ready types in seconds, fully typed for nested objects, arrays, and optional fields.
Examples
API response
{"id":101,"name":"Ada Lovelace","email":"ada@example.com","active":true,"roles":["admin","user"]} Turn a typical REST API user payload into a typed interface you can drop into your client.
Nested objects
{"order":{"id":"A-1","total":42.5,"customer":{"name":"Sam","vip":false}}} Nested objects become separate, named interfaces (Order, Customer) referenced by field.
Array of objects (optional fields)
{"users":[{"id":1,"nick":"x"},{"id":2}]} Keys missing from some array items are inferred as optional (nick?: string).
Mixed and null values
{"tags":["a","b"],"score":null,"meta":[1,"two"]} Null values and mixed arrays are typed honestly (null, (string | number)[]).
GitHub-style payload
{"login":"octocat","id":1,"public_repos":2,"plan":{"name":"pro","private_repos":50}} Snake_case keys are kept verbatim; nested plan becomes its own interface.
How to convert JSON to TypeScript
- 1
Paste your JSON
Drop a JSON object, array, or API response into the input box. Conversion starts instantly.
- 2
Tune the output
Pick interface or type, set a root name, toggle export, and choose ?: or | null for optional fields.
- 3
Copy or download
Grab the generated TypeScript with one click and paste it straight into your codebase.
How the conversion works
- Structural inference
- Each object becomes a named interface; identical shapes are deduplicated so you get one type, not copies.
- Array merging
- Arrays of objects are merged key-by-key; keys absent from some items are marked optional.
- 100% client-side
- Parsing and generation run in your browser with no network calls, so your data stays private.
Tips for clean TypeScript types
- Name your root type
- Set a meaningful root name (e.g. User, ApiResponse) instead of the default Root for readable code.
- Prefer optional over null when data is sparse
- Use ?: for fields that may be absent and | null only when the API explicitly returns null.
Frequently asked questions
How do I convert JSON to a TypeScript interface?
Should I use type or interface for JSON data?
interface is conventional for object shapes and gives slightly better editor errors; type is handy for unions and intersections. Use the Output toggle to switch between them and keep whichever your codebase prefers. How are nested objects and arrays handled?
address field yields an Address interface). Arrays of objects are merged into one element interface; primitive arrays become typed arrays like string[]. How are optional and null fields handled?
?: (optional) or | null (explicit nullable) with the Optional fields toggle. Literal null values are typed as null. How do I generate TypeScript types from JSON automatically in VSCode?
Is my JSON data private and safe?
Is the tool free? Do I need an account?
Can it detect dates or enums?
string (safer than guessing). String values are typed as string rather than literal unions, so the output stays stable as your data changes. Related Tools
View all tools →Base64 Decoder & Encoder
Encoding & Formatting
Decode and encode Base64 online for free. Real-time conversion with full UTF-8 and emoji support. 100% private — runs in your browser. No signup needed.
Base64 to Image Converter
Encoding & Formatting
Decode a Base64 string or data URI back into an image in your browser. Preview, read dimensions & MIME, then download as PNG, JPG, GIF, SVG. No upload.
CSV to JSON Converter
Encoding & Formatting
Convert CSV to JSON in your browser. RFC 4180, type inference, header row, big-int safe. 100% private, no upload.
.env to JSON Converter
Encoding & Formatting
Paste a .env file, get JSON instantly. Your database passwords, API keys and tokens never leave your browser — 100% private, no upload, free dotenv parser.
Free HTML Entity Decoder — Unescape HTML
Encoding & Formatting
Decode HTML entities and unescape HTML online — free, no signup, 100% in your browser. Converts named, decimal & hex references back to characters; never uploaded.
Free HTML Entity Encoder — Escape HTML
Encoding & Formatting
Encode HTML entities and escape special characters (< > & " ') online — free, no signup, 100% in your browser. Named, decimal, or hex output; never uploaded.