JSON to TypeScript

Generate TypeScript interfaces or type aliases from a JSON sample.

Data & Formats
Preparing your workspace…
Input
Output
Your result will appear here.

How to use

  1. Paste text, open a UTF-8 file, or try the Sample.
  2. Choose the input and settings, then run the tool or enable Auto run.
  3. Review the result, then copy or download it. Changing the input invalidates the previous result.

JSON to TypeScript

Generate TypeScript interfaces or type aliases from a JSON sample.

Processing runs in your browser. Your input is not sent to DevToolsy.

How it works

Nested objects become named types. Array records are merged, missing properties become optional, and mixed values form unions. Empty arrays use unknown[].

Before and after
Input
{"project":"DevToolsy","members":[{"name":"Ada","role":"developer"},{"name":"Lin","active":true}],"tags":["web","tools"]}
Output
export interface Root {
  project: string;
  members: RootMembersItem[];
  tags: string[];
}

export interface RootMembersItem {
  name: string;
  role?: string;
  active?: boolean;
}

Generate TypeScript interfaces or type aliases from a JSON sample.

Options and data fidelity

Choose a root type name, interface or type, readonly properties, and optional properties. Strings remain string types; values are not inferred as literals.

Working with the result

One sample cannot describe every possible response. Review nullability, missing fields and number precision, then add runtime validation separately.

Review the result, then copy or download it. Changing the input invalidates the previous result.

Processing limits

UTF-8 input up to 1 MiB per document, output up to 8 MiB. JSONPath and Schema: 5-second timeout; other tools: 30 seconds.

?

Frequently asked questions

How are nested objects and arrays inferred?

Nested objects become named types. Array records are merged, missing properties become optional, and mixed values form unions. Empty arrays use unknown[].

Which TypeScript options can I change?

Choose a root type name, interface or type, readonly properties, and optional properties. Strings remain string types; values are not inferred as literals.

Does this validate future API responses?

No. One sample cannot describe every possible response. Review nullability, missing fields and number precision, then add runtime validation separately.

Is my input uploaded?

Processing runs in your browser. Your input is not sent to DevToolsy.

Can I open a local file?

UTF-8 input up to 1 MiB · output up to 8 MiB

Find your next tool

Language

Switch language? Your current work will be cleared. Copy or download it first.