Neatbo.

JSON to TypeScript

Turn an API response into nested types with arrays, unions and null values.

Browser-local processingInputJSONOutputTypeScriptUp to 10 MiB per file · File limit: 1
  1. 1Add input
  2. 2Adjust settings
  3. 3Get your result

Tool input and files are processed in this browser without being uploaded.

Your input

Inputs are kept temporarily in this tab when switching tools. Refreshing or closing clears them; large results may need to be regenerated.

⌘ / Ctrl + Enter to run
JSON source
0 characters · 0 bytes

Output type

The top-level TypeScript type name, such as ApiResponse. Check for naming conflicts in your project.

Preparing the tool…

Before you start

Generate a TypeScript type alias or a top-level interface from a JSON response, including nested objects, arrays and null values. Fields missing from some objects in a sample array become optional; fields absent from the entire sample cannot be inferred. Large JSON numbers become number, so review precision requirements.

How to use this tool

  1. Choose Paste JSON or Choose a file, then provide one JSON object or array.
  2. Set the output name and choose a type alias or an interface. Interfaces require a top-level JSON object.
  3. Review optional fields, null values and number precision, then copy or download the .ts file.

Supported inputs and limits

Types describe this sample only. Optional fields are inferred only when they vary among objects in a sample array. Types do not validate runtime data.

Processing stays in your browser. Pasted text is limited to 1 MiB.

Worked example

Example input

{"id":1,"tags":["local",null],"active":true}
Example options
{}

Example output

export type Root = {
  "id": number;
  "tags": Array<string | null>;
  "active": boolean;
};

When something does not work

Types describe the supplied sample. Check optional fields, other possible values, number precision and runtime validation against the actual API contract.

Frequently asked questions

Are files uploaded?

No. File bytes and input are processed in this browser.

Does the output include every optional field?

Fields missing from some objects in a sample array become optional. Fields absent from every sample, other possible values and business constraints still need the actual API contract.

Do TypeScript types validate runtime data?

No. Generated declarations support development-time checks. Your application still needs runtime validation and error handling where appropriate.

Documentation & further reading

Related tools