Home / Web & Developer / JSON to TypeScript Converter
🟦 JSON to TypeScript Converter
JSON to TypeScript Converter – get instant, free results right on your device.
Types are inferred from the sample data; review the result manually for optional fields and multiple possible types. Not an official institution.
Last updated: November 2026 · Parameter year: 2026 · Methods and sources: Methodology · Editorial policy
What is JSON to TypeScript Converter?
When working with TypeScript, writing the type of JSON data returned from an API by hand is time-consuming and error-prone. Inferring types automatically from JSON saves time, especially when you start working with a new endpoint.
The tool reads the JSON sample you paste and creates separate interfaces for nested objects. Text comes out as string, numbers as number, and boolean values as boolean; arrays are written as type[], and empty arrays as unknown[]. Objects with the same structure are merged into a single interface. You can set the root interface name yourself.
Because the types are inferred only from the sample you provide, optional fields (?) and multiple possible types may require you to review the result by hand. The JSON you provide is processed in your browser and is not sent to a server.
How to use
Fill in these fields: Root interface name, JSON. Then press the button; the result appears on the same page and your data never leaves your device.
Formula
{"id":1,"name":"Ali"} → interface Root { id: number; name: string; }
Example
{"id":1,"name":"Ali"} → interface Root { id: number; name: string; }
Worked examples and tips
Example 1: With the root interface name Kullanici and the JSON {"id":1,"ad":"Ali","aktif":true,"etiketler":["a","b"],"adres":{"sehir":"Ankara","posta":6100}}, the tool builds the Kullanici interface with the fields id: number, ad: string, aktif: boolean, etiketler: string[], and adres: Adres. For the nested object, it also defines a separate Adres interface with sehir: string and posta: number.
Example 2: If the root name is Siparis and the input is {"no":7,"not":null,"tutar":99.9,"kalemler":[{"kod":"A1","adet":2}]}, in the result you see no: number, not: null, tutar: number, and kalemler: Kalemler[]. For the object inside the array, a separate Kalemler interface is created with kod: string and adet: number.
Example 3: In the simplest case, the input {"id":1,"ad":"Ali"} with the name Root gives the result interface Root { id: number; ad: string; }. The tool infers only from the example you provide.
Tips and common mistakes: An example is a single record; making fields that are missing in some records optional is up to you. A field whose value is null comes out in the tool as the null type; in reality it might be a string or number, so correct the output by hand. When converting a large and varied array, prepare a sample record that covers all the different shapes. Do not put real personal data in it; made-up values are enough.
Frequently asked questions
JSON to TypeScript Converter – how to use it?
Fill in the fields and press the button; the result appears instantly. Example: {"id":1,"name":"Ali"} → interface Root { id: number; name: string; }
JSON to TypeScript Converter – is it free, and is my data stored?
Yes, it is free and requires no sign-up. Because processing happens in your browser, the information you enter is not sent to a server.
Related guide
- What Is JSON? Structure, Formatting, Validation and Finding Errors – What is JSON and how do you read and validate it? A nested example, a valid/invalid comparison table, number and date traps and the formatting difference.