JSON to TypeScript Interface Converter

Generate TypeScript interfaces from a sample JSON object.

πŸ”’ Runs in your browser⚑ Instant resultsπŸ†“ Free, no sign-up

How to use JSON to TypeScript Interface Converter

  1. Paste or type your text into the box. If you just want to see how JSON to TypeScript Interface Converter behaves, press Load example.
  2. Look at the option above the boxes (Root interface name). The defaults suit most jobs, so change them only if you need to.
  3. Your result appears on the right as you type. There is no convert button to hunt for.
  4. Click Copy result to paste it somewhere else, or Download to save it as a text file. Use result as input lets you run a second conversion on the output.

What is it good for?

Generate TypeScript interfaces from a sample JSON object. It saves you the tedious retyping that comes with doing this by hand.

It works on whatever you paste, line by line where that makes sense, and it handles non-English text properly, because it works with Unicode and not just plain English letters. People most often reach for it when moving data between JSON, CSV, XML and YAML, checking what a token or encoded value really contains and debugging an API response that came back as one unreadable line.

See it in action

Here is a quick example so you can see what to expect.

You type{"id":1,"name":"Asha","active":true,"tags":["a","b"],"address":{"city":"Pune","pin":"411001"}}
You getinterface User { id: number; name: string; active: boolean; tags: string[]; address: Address; } interface Address { city: string; pin: string; }
Good to know. Use a response that contains every field you expect. A field missing from the sample will be missing from the types.

Tips for better results

For a repeated job, keep the tool open in a tab. You can paste a new text over the old one and the output refreshes straight away.

Empty input gives an empty result, which is normal. Paste something, or press the sample button to see how the tool behaves.

If the result is not what you expected, look at the options above the box. A single setting, such as case sensitivity or the separator, often explains it.

Privacy

Everything you paste is processed by JavaScript in your own browser. It is not uploaded, logged or stored on our servers, so it is fine for private lists and drafts.

Frequently asked questions

Is JSON to TypeScript Interface Converter free to use?

Yes, completely free. There is no sign-up, no watermark and no limit on how many times you use it.

Is my data safe when I use JSON to TypeScript Interface Converter?

Your text is processed in your browser by JavaScript. It is not sent to our servers, so it stays private.

Does JSON to TypeScript Interface Converter work on my phone?

Yes. The layout adapts to small screens, and the tool works in current versions of Chrome, Edge, Firefox and Safari.

Any tips for using JSON to TypeScript Interface Converter?

Use a response that contains every field you expect. A field missing from the sample will be missing from the types.