JSON to TypeScript Interface Generator

Paste JSON and generate clean TypeScript interfaces locally with configurable names, optional fields, arrays, and type inference.

Paste JSON or load a sample to begin.

JSON Input

Objects, arrays of objects, nested values, primitives, nulls, and mixed arrays are analyzed locally.

Processed locally in your browser Limit 5 MB. Your input is processed in your browser and is not uploaded or sent to a server. Avoid pasting production secrets, access tokens, private keys, passwords, or sensitive customer data unless you understand the risk.

TypeScript Output

Generated declarations are deterministic, readable, and ready to copy into a model file.

TypeScript generation options

Generation details

Validation, summary, and warnings

Details appear after generation

Generate TypeScript to see JSON validation status, inferred declarations, property counts, arrays, and warnings.

JSON to TypeScript Guide

Generate TypeScript models from JSON samples

Convert API examples, mock responses, configuration data, and fixtures into TypeScript declarations locally without uploading JSON.

What is a JSON to TypeScript generator?

It reads valid JSON and infers TypeScript interfaces or type aliases that describe the object shape, nested values, arrays, primitives, and nullable fields.

Interface generation

Objects generate named interfaces by default. Nested objects receive deterministic names derived from the root name and property path.

Arrays and nested objects

Arrays of objects are merged into one object shape. Missing fields can become optional, while nested arrays and objects generate reusable declarations.

Optional fields

When enabled, fields missing from some array items or represented as null in the sample are marked optional so generated models better match common API payloads.

Quoted property names

Original property names are preserved by default. Names that are not valid TypeScript identifiers are emitted as quoted properties.

Types vs manual models

Generated declarations are a fast starting point. Review final models for domain names, reused types, stricter unions, dates, and API-specific semantics.

Date strings

Date detection is off by default because JSON only contains strings. Enable it when your sample intentionally represents ISO dates as Date values in TypeScript.

Privacy

Parsing and generation run locally in your browser. JSON input, property names, generated TypeScript, and errors are not uploaded or logged.

JSON to TypeScript FAQ

Does this tool upload my JSON?

No. JSON parsing and TypeScript generation run locally in your browser.

Can it generate interfaces from an array of objects?

Yes. Arrays of objects are merged into one interface shape, and missing fields can be marked optional.

What happens with mixed arrays?

Simple mixed primitive arrays may generate a union. Ambiguous arrays, especially object-plus-primitive arrays, fall back to unknown with a warning.

Are invalid property names supported?

Yes. Property names that cannot be emitted as normal TypeScript identifiers are preserved as quoted property names.

Can I use type aliases instead of interfaces?

Yes. Choose type in the declaration style option to emit object type aliases instead of interfaces.

Should generated types replace manual models?

Use generated declarations as a starting point, then refine names, reuse shared models, and tighten domain-specific types manually.