JSON to TypeScript

Generate TypeScript interfaces or Zod schemas from a JSON sample
  • Files never leave your device
  • Runs in your browser
  • Free, no sign-up, no watermark

Objects in the same array are merged: keys missing from some items become optional, and differing value types become unions. Identical shapes share one type.

How to use JSON to TypeScript

Paste a JSON sample and get TypeScript interfaces, a Zod schema, or a JSON Schema. Objects in arrays are merged, so keys missing from some items become optional and mixed types become unions. Everything runs locally in your browser.

  1. 1

    Paste a JSON sample into the JSON box, drop a file, or click Sample.

  2. 2

    Pick an Output: TypeScript, Zod, or JSON Schema, and set the Root name.

  3. 3

    Choose how Null values are typed, and for TypeScript whether to Declare as interface or type.

  4. 4

    Toggle Detect date strings, Readonly properties, or Disallow extra properties as needed, then copy or download the result.

Frequently asked questions

Is the JSON sent anywhere?

No. Type generation runs in your browser, so API responses with real data stay on your device.

How are arrays of objects with different keys handled?

They are merged into one type. Keys that some items lack become optional, and keys with different value types become unions. Identical shapes share one type.

What is the difference between T | null and Optional + null?

T | null keeps the key required but allows null. Optional + null also lets the key be left out, which suits APIs that drop null fields.

Does it detect dates?

With Detect date strings on, ISO 8601 strings get a comment in TypeScript, a datetime validator in Zod, and a format in JSON Schema.

Can I paste JSON with comments or trailing commas?

Yes. Input is parsed leniently, so comments, trailing commas, and JSON5 syntax are accepted, and a note tells you when that happened.