Skip to main content
Tools Generate
TS

JSON to TypeScript Interface Generator

v1.0 · Everything below stays in your browser

Paste JSON, get a TypeScript interface with optional/required inference and nested types. Free, browser-only, no upload.

Runs entirely in your browser · Your input is never transmitted

Paste JSON
JSON INPUT
0 BReady
TYPESCRIPT
 
0 interfaces

How to use

  1. Paste a JSON sample or array of records into the input pane.
  2. The TypeScript interface is generated automatically with nested types.
  3. Click Copy to grab the result.

Frequently asked

How is required vs optional inferred?

When you paste an array of records, keys present in every element are required; keys missing from any element are marked optional with ?:. A single object treats every key as required — pass an array if you want optional inference.

What about null vs undefined?

JSON null becomes the TypeScript null type. There is no undefined in JSON, so optional fields use ?: (which resolves to T | undefined). If a field can be either present-with-null or absent, hand-edit it to field?: T | null.

Why unknown instead of any?

Empty arrays and all-null fields can't be safely typed from a sample. The tool emits unknown so you must narrow before use, instead of any which silently lets bugs through.

Does it leave my browser?

No. Parsing and code generation run entirely client-side via JSON.parse. Safe for production payloads.