Omnikit
DevFilesMoneyAll tools
Ctrl K
Dev toolsFile toolsMoney calculatorsAll tools
HomeDeveloper toolsJSON to TypeScript
EnglishالعربيةবাংলাDeutschEspañolFrançaisPolskiPortuguêsРусский

JSON to TypeScript

dev

Generate TypeScript interfaces or types from a JSON sample

Runs in your browser. Nothing you type is sent anywhere. Updated on 24 Oct 2026.

Typing an interface by hand from a JSON response is tedious and easy to get wrong. Paste 1 sample and get TypeScript interfaces or types back, with nested objects and arrays handled. The sample stays in your browser, so a response full of real data goes nowhere.

Next:
  • JSON Formatter & Validator Format, validate, minify and sort JSON with exact error positions
  • JSON Schema Validator Validate JSON against a JSON Schema (2020-12, 2019-09, draft 7), with each error located

How to convert JSON to TypeScript types

1

Paste a sample JSON response into the JSON pane, or click Try an example.

2

Set the Root name and choose Interface or Type.

3

Choose how null values are typed, "| null" or Optional, and turn Export or Readonly on or off.

4

Click Copy, or the download icon to save a .ts file named after the root type.

About JSON to TypeScript

This JSON to TypeScript converter reads a sample of your data and writes the matching interfaces or type aliases. Every nested object gets its own named declaration, arrays get element types, and the output updates as you type, so you can paste a response and copy working types a second later.

Developers use it when wiring up a new API: paste one response from the network tab and get the types for the fetch call. It also helps when a config file or a webhook payload has grown too large to type by hand, or when you inherit untyped JSON fixtures and want the compiler to start catching mistakes.

The generator looks at every element of an array, not just the first. Objects in an array are merged into one interface, and a key that is missing from some of them becomes optional. A field that holds different kinds of value becomes a union, such as string | number. Null values either add | null or make the property optional; you choose. Identical shapes share one declaration, and keys such as pin-code are quoted.

Everything runs in your browser and nothing you paste is sent anywhere. The types describe only the sample you give, so include an example of every variant you expect. Ctrl+Enter copies the result. Related tools: JSON Formatter, YAML to JSON, CSV to JSON.

Frequently asked questions

How do I convert JSON to a TypeScript interface?

Paste the JSON into the left pane. The interfaces appear on the right as you type. Set the root name, choose interface or type, then press Copy or Ctrl+Enter and paste the result into a .ts file.

Is this JSON to TypeScript converter free, and is my JSON uploaded?

Everything here is free, with no signup and no cap on conversions. The conversion runs entirely in your browser, so the JSON you paste never leaves your device and no copy reaches a server. API responses carrying access tokens, email addresses or order details are safe to paste.

How are optional properties detected?

When an array holds several objects, they are merged into one interface. A key that appears in only some of them is marked optional with a question mark. With the null option set to optional, a key whose value is null is also marked optional.

Should I use interface or type?

Both describe the same shape. Interfaces can be extended and merged, and many teams prefer them for objects. Type aliases can also express unions and mapped types. Pick whichever your codebase already uses; the tool writes either.

What happens with arrays of mixed values?

The element type becomes a union, for example (string | number)[]. An empty array becomes unknown[] because there is nothing to infer from; add one example item to get a precise type.

Does it handle very large or deeply nested JSON?

Yes. Files of a few megabytes convert in well under a second. Deep nesting is fine; each level gets its own named declaration, and identical shapes are reused rather than repeated.

Still stuck? Ask about JSON to TypeScript and anybody who knows can answer. No account needed.

Also works as: JSON to TS · JSON to Interface.

Same job, other tools: JSON to Kotlin for Gson – Paste JSON and get Kotlin data classes with @SerializedName for Gson · TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · JSON to YAML – Turn JSON into clean, readable YAML for configs.

On the related tools: IPv6 Subnet Calculator – IPv6 prefix range, address count as a power of two, and /64 subnets per prefix.

Related tools

All developer tools
Subnet CalculatorIPv4 and IPv6 CIDR: network, broadcast, host range, mask, wildcard and subnet splitsRegex EscapeEscape text so a regex matches it literally in JavaScript, Python, PHP, Java, Go or .NETJSON to Kotlin Data Class ConverterTurn a JSON sample into Kotlin data classes for kotlinx.serialization, Gson or MoshiHTML to JSX ConverterPaste HTML and get JSX React accepts: className, style objects, closed tags, camelCaseBase64 Encode & DecodeText and files to Base64 and back, with URL-safe mode and image previewUnix Timestamp ConverterUnix timestamps to dates and dates to timestamps, in any time zoneCSV to JSONConvert CSV to JSON and JSON to CSV, with a table previewYAML to JSONConvert YAML to JSON and JSON to YAML, with anchors resolved

In the collection JSON Tools.

Was this tool helpful?
Omnikit

Small jobs, done in your browser. Free, fast and private. Files are never uploaded.

Files

  • Compress Image
  • Image to PDF
  • Merge PDF
  • Compress PDF
  • PDF to Word
  • Word to PDF

Dev

  • JSON Formatter & Validator
  • Base64 Encode & Decode
  • JWT Decoder, Verifier & Encoder
  • Password Generator
  • UUID Generator
  • Unix Timestamp Converter

Money

  • SIP Calculator
  • EMI Calculator
  • GST Calculator
  • FD Calculator
  • PPF Calculator
  • Lumpsum Calculator
EnglishالعربيةবাংলাDeutschEspañolFrançaisPolskiPortuguêsРусский
GuidesQuestionsAboutHow we checkLaw library (beta)PrivacyTermsDisclosureContactMore: Exam practice (UGC NET Paper 1)Runs in your browser. Nothing is uploaded. © 2026 Omnikit (theomnikit.com)