Tools/JSON to TypeScript

JSON to TypeScript

Generate TypeScript interfaces from any JSON object.

JSON
TypeScript

Runs entirely in your browser — your data never leaves this page.

About the JSON to TypeScript

This JSON to TypeScript converter generates strongly-typed interfaces from a sample JSON object. Paste an API response or config, and it infers the shape — turning nested objects into their own named interfaces and inferring array element types — so you can drop the result straight into your codebase.

It saves you from hand-writing types for large payloads and helps catch shape mismatches at compile time. Everything runs locally in your browser.

How to use it

  1. 1Paste a representative JSON object or array.
  2. 2Optionally set the root interface name.
  3. 3Copy the generated TypeScript interfaces into your project.

Common use cases

  • Typing an API response quickly
  • Bootstrapping types from a JSON config file
  • Turning a fixture into an interface
  • Learning how nested types map to TypeScript

Frequently asked questions

How does it handle nested objects and arrays?

Nested objects become their own named interfaces, referenced from the parent. Arrays infer their element type from the first item, so provide a representative example with populated arrays for the best result.

Why are some fields typed as unknown?

Empty arrays give the tool nothing to infer from, so their element type falls back to unknown[]. Fill in at least one element, or adjust the generated type manually afterward.

Does it detect optional fields?

It types exactly what is present in the sample. If a field is optional in your real data, add the ? modifier yourself, or paste a sample that represents the fullest possible object.