Kharabeesh
On-device ع

JSON to TypeScript

Turn sample JSON into ready TypeScript interfaces: names from the keys, records in arrays merged, optional fields for missing keys, plus null and readonly as you choose.

Free, no sign-up Your data stays on your device Works offline after first open

The tool

Loading the tool…

How to use

  1. Paste sample JSON (more than one record is better).
  2. Type the root name and choose interface or type.
  3. Decide on optional fields for missing keys, readonly and export.
  4. Copy the code or download it as a .ts file.

Privacy & how it works

Processes your data in the browser and stores nothing.

  • Engine: lightweight in-page code, no external libraries.
  • Works offline after you open it once.

Frequently asked questions

How are nested types named?

From the key in PascalCase: address becomes Address, and items of a users array become User. Identical shapes reuse the same name.

When is a field optional (?)

When it appears in some objects of the same array but not in others.

Why do I get unknown[]?

The array is empty in your sample, so its item type is unknown. Add at least one item to the sample.

Related tools