Skip to content
tooljig
PricingSecurity
tooljig

Exact tools. Nothing leaves your device. Small, exact tools for everyday work. Most run entirely in your browser.

Instruments

  • Text tools
  • Developer tools
  • Calculators
  • Date & time
  • Converters
  • Generators

Files

  • PDF
  • Image
  • Video & Audio
  • Data
  • Web

Tooljig

  • Pricing
  • Security
  • Dashboard
  • About
  • Contact
  • Privacy
  • Terms
© 2026 TooljigFiles processed in the cloud are deleted automatically
Index / Developer tools / T-52

T-52 · Developer tools

JSON to TypeScript

Generate TypeScript interfaces or types from a JSON sample. Nested objects get named interfaces; array items are merged with optional fields.

  • Runs in your browser
  • Nothing uploaded
  • No account
Instrument T-52 · JSON to TypeScriptLocal
Declare as

About this instrument

What it does

Paste a JSON response or config sample and get TypeScript declarations for it. Nested objects become named interfaces (from their key, in PascalCase), identical shapes are declared once, array elements are merged into one type with fields that are missing from some elements marked optional, mixed arrays become unions and null values become “| null”. Choose interface or type, readonly fields, export and the root name.

How to use it

  1. Paste a JSON sample.
  2. Set the root name and options.
  3. Copy the TypeScript or download it as types.ts.

Limits and notes

Good to know

  • Types are inferred from the sample only: a field that is null in the sample is typed null, and an empty array becomes unknown[]. Use a sample that shows every field with a real value for the best result.
  • Names for array items come from the key with a simple English singular (orders → Order, categories → Category). Keys that are not valid identifiers are quoted, and clashing names get a number (Item2).

FAQ

Common questions.

01Interface or type: which should I choose?+

For object shapes they are interchangeable in most code. Interfaces can be extended and merged; type aliases can also describe unions. The output is equivalent either way.

02How are fields marked optional?+

When an array contains several objects, a field that appears in only some of them gets a ?. Fields in a single object are always required.

03Is my JSON uploaded?+

No. Parsing and type generation run in your browser.

Related instruments

  • T-05JSON FormatterFormat, validate and minify JSON with clear error messages that point to the line and column. Runs entirely in your browser.Local↗
  • T-08JWT DecoderDecode a JSON Web Token to read its header, payload and expiry. Decoding happens in your browser and the token is never sent anywhere.Local↗
  • T-02Case ConverterConvert text to uppercase, lowercase, title case, sentence case, camelCase, PascalCase, snake_case, kebab-case or CONSTANT_CASE in one click.Local↗