JSON to TypeScript Converter

Generate TypeScript interfaces from any JSON object or API response — instantly in your browser.

Input JSON
TypeScript Output

How to Use

  1. 1 Paste your JSON object or API response into the Input JSON panel.
  2. 2 Click Convert to TypeScript to generate TypeScript interface definitions.
  3. 3 Review the generated interfaces in the TypeScript Output panel.
  4. 4 Click Copy to copy the interfaces to your clipboard, ready to paste into your codebase.
  5. 5 Use Sample Input to load example JSON and see how nested objects are handled.
  6. 6 Click Clear to reset both panels.

Frequently Asked Questions

Is my JSON data sent to a server?

No. All conversion happens entirely in your browser using JavaScript. Your JSON data never leaves your device and is never stored or logged anywhere.

Does this support nested JSON objects?

Yes. Nested objects generate nested TypeScript interfaces. Each nested object gets its own interface definition with a descriptive name derived from the parent key.

How are JSON arrays handled?

Arrays are typed based on their contents. An array of strings becomes string[], an array of numbers becomes number[], and an array of objects generates a typed interface array like MyItem[].

How are null values typed?

Null values are typed as null in the generated interfaces. If a field can be both a value and null, you may want to manually update the type to string | null or number | null.

What TypeScript types are generated?

The converter maps JSON types to TypeScript types: strings → string, numbers → number, booleans → boolean, null → null, objects → interface, arrays → typed arrays. Unknown types default to any.

Can I use this with API responses?

Yes. Paste any JSON API response and get TypeScript interfaces ready to use in your frontend code. This is especially useful when working with REST APIs that don't provide TypeScript types.

Does it generate optional fields?

The converter generates required fields by default based on the sample JSON. If a field might be absent in some responses, you can manually add ? to make it optional (e.g. name?: string).

What is the root interface named?

The root interface is named RootObject by default. Nested interfaces are named based on their parent key (e.g. a key "user" generates a User interface). You can rename them after copying.