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 →ASCII Table and Converter
Encoding & Formatting
The full ASCII table: 128 characters in decimal, hex, octal and binary, plus a two-way text-to-ASCII converter. Control characters come with escape sequences, caret notation and where you actually meet them.
Free Barcode Generator — EAN-13, UPC-A & Code 128
Encoding & Formatting
Generate EAN-13, UPC-A, Code 128, Code 39 and 11 more barcode types as SVG or print-ready PNG. Type 12 digits and the check digit is filled in; get one wrong and we name the digit it should be.
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.
Base64 to PDF & File Converter · PDF to Base64
Encoding & Formatting
Convert Base64 to PDF online: paste raw Base64, a data URI or a whole JSON response. Detects the real file type, flags truncated PDFs, and does PDF to Base64.
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.