Skip to content

Install ALink Tools

Free browser tools for images, PDFs, media, text and web checks. Most tools process files locally on your device.

  1. Tap the Share button in the Safari toolbar.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. ALink Tools then opens from your Home Screen like an app.

JSON to TypeScript

Paste JSON and get TypeScript types in this tab. Objects become named interfaces, mixed arrays become unions, and a field missing from some items is marked optional. ISO date strings stay string. Nothing is uploaded.

Runs in your browserRuns in your browserNothing is uploadedBuilt-in inferencer
1

Input

2

Result

How to use JSON to TypeScript

  1. Paste or open JSONType, paste, or open a .json file. The limit is 1 MB. Comments and trailing commas are not accepted — only standard JSON.
  2. Name the root typeSet a TypeScript type name for the root, such as Root, and choose whether each type is exported. Then convert the JSON.
  3. Copy or downloadCopy the types or download types.ts. If the JSON is invalid, an error is shown instead of a type file.

Limits and how it works

  • The input is limited to 1 MB of UTF-8 text, including files you open, a maximum depth of 64, and a cap on how many values can be walked.
  • Only standard JSON is accepted. Comments, trailing commas, and JSON5 or JSONC syntax are rejected.
  • ISO date strings, UUIDs, and similar formats stay string. They are not turned into Date or branded types.
  • A syntax error is reported without repeating the input. The file is not repaired automatically.

How types are inferred

This page walks the parsed JSON and writes TypeScript. Object values become interfaces. Arrays of objects merge their fields: a key present in every item is required, and a key missing from some items is optional. Mixed item types become a union such as string | number. Empty arrays are unknown[]. Null stays null, so a field that is sometimes a string and sometimes null is string | null.

The inferencer is written for this page. It does not use quicktype-core. That library is Apache-2.0, which is allowed, but the published package is about 4.2 MB unpacked — too large to ship here. This built-in typist does not infer Date from ISO-8601 strings; those values stay string. It does not read JSONC or JSON5.

JSON numbers follow JavaScript’s IEEE-754 precision. Integers larger than 2^53−1 may already be rounded by JSON.parse before types are written. Property names that are not valid identifiers, or reserved words such as class, are quoted. This is a typist, not a runtime validator.

Frequently asked questions

Is my JSON uploaded?

No. Everything runs in your browser tab with JavaScript. Nothing you type, paste, or open is sent to a server, logged, or stored by ALink Tools.

Is this the Schema Generator?

No. Schema Generator writes Schema.org JSON-LD markup for pages. This tool infers TypeScript interfaces from a JSON value.

Why don’t you use quicktype?

quicktype-core is Apache-2.0, but the published package is about 4.2 MB unpacked. This page uses a smaller built-in inferencer instead.

Will an ISO date become Date?

No. Strings stay string, including ISO-8601 timestamps. You can change a field to Date by hand if your code parses it.

Related tools

All tools