{ }jsonkit
Tools/Convert/JSON to TypeScript
Search tools…⌘K
Format
{ }JSON Formatter
≡→JSON Minifier
\"JSON Escape / Unescape
Validate
JSON Validator
±JSON Diff / Compare
§JSON Schema Generator
JWT Decoder
Convert
→csvJSON to CSV
csv→CSV to JSON
⇄ymlJSON ⇄ YAML
⇄xmlJSON ⇄ XML
→tsJSON to TypeScript
Query
$.JSONPath / JQ Tester
Generate
Mock JSON Data Generator
→ts

JSON to TypeScript Interfaces

Nested types with optional-property detection.
processes as you type · client-side
Sample
Upload
Optional detection
export keyword
⧉ Copy output ⌘C
Download
Share
Clear
Input219 B · paste or drop a file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14
export interface Plan { tier: string; seats: number; renews: string; } export interface Root { id: string; name: string; email: string; active: boolean; roles: string[]; plan: Plan; }
✓ valid (RFC 8259)219 B → 202 B0.0 msLn 1, Col 1UTF-8

About JSON to TypeScript

The JSON to TypeScript converter generates TypeScript interfaces from a sample JSON document. Paste an API response and get typed interfaces describing its shape, so you can drop them into your code and get autocomplete and compile-time checks instead of untyped any.

Generation happens in your browser with no upload, so you can safely turn a real production payload into types without it leaving your machine. It is free and requires no account.

It is for front-end and full-stack developers who consume JSON APIs and want accurate types fast, without hand-writing interfaces for every nested object.

How it works

Nested interfaces

Each nested object becomes its own named interface, and the parent references it by name. This produces clean, reusable types instead of one giant inline shape, matching how you would structure them by hand.

Optional-property detection

When the input is an array of objects that don't all share the same keys, optional detection marks the keys that are missing from some elements as optional with a ? modifier. This captures the real, sometimes-present shape of list data rather than assuming every field is always there.

The export keyword

Toggle whether interfaces are prefixed with export. Turn it on to drop the types straight into a module that other files import; turn it off for a local, self-contained snippet.

Type inference and its limits

Types are inferred from the sample values: strings, numbers, booleans, arrays and nested objects. Because a single example can't show every case, an empty array becomes any[] and a field that is null in the sample can't reveal its real type — refine those by hand.

Frequently asked questions

How does it decide which properties are optional?

With optional detection on and an array of objects as input, any key that is absent from at least one element is marked optional with ?. A single object gives no evidence of optionality, so all its keys are treated as required.

Why did a field come out as any?

The sample didn't carry enough information — for example an empty array or a null value can't reveal the element or field type. Provide a fuller example or adjust the generated type by hand.

Can I paste production API responses safely?

Yes. Generation runs entirely in your browser, so the payload you paste is never uploaded.

Should I turn on the export keyword?

Turn it on if you'll import the interfaces from other files; leave it off for a local or throwaway snippet.

Does it name the nested interfaces sensibly?

Yes. Nested objects are extracted into separate named interfaces derived from their property names, so the output reads like types you'd write yourself.