Skip to main content

JSON to TypeScript

Generate TypeScript interfaces and types from JSON data.

converttypescripttypes
Read the guide
Shortcuts:⌘ KSearch

Frequently Asked Questions

If I paste an array, does it inspect every item before generating types?

No. Root arrays use only the first element, and nested arrays also infer their type from the first item only.

How does it represent nulls or empty arrays?

A null value becomes the literal type null. Empty arrays become unknown[], because there is no sample item to infer from.

Can I rename the root interface?

Yes. The Root name field updates the generated top-level interface name live.

Will nested objects become separate interfaces?

Yes. Every nested object generates its own interface named from the property key.

Why does it error on a primitive JSON value?

This generator only accepts an object or an array at the root. A plain string, number, boolean, or null root triggers an error.

Related Tools