ToolboxKit

JSON to TypeScript Converter

Paste a JSON sample, such as an API response, to generate matching TypeScript interfaces. Nested objects get their own named types.

Your files never leave your device — everything runs in your browser.

JSON
TypeScript

How to Use

  1. 1Paste a JSON sample, ideally a real API response.
  2. 2Set the name of the root type, for example User or ApiResponse.
  3. 3Choose whether to generate interface or type declarations.
  4. 4Copy the generated code, or download it as types.ts.

Frequently Asked Questions

How are optional fields detected?

When your JSON has an array of objects, the generator merges all items. A key that's missing from some items is marked optional (?). You can also make every field optional.

What type does null get?

A null value becomes the null type. If the same field holds a string in some items and null in others, you get a union like string | null.

Should I use interface or type?

For plain object shapes they're mostly interchangeable. Interfaces can be extended and merged. Type aliases also work for unions and other types. Pick whichever your codebase already uses.

Is my JSON sent anywhere?

No. The types are generated in your browser, so API responses with private data stay on your device.

Related Tools