Skip to main content
忆云竹

JSON to TypeScript types

Infer TypeScript types from JSON samples, including nested objects, optional properties, arrays, unions and null.

Types are inferred from this sample. Missing object properties become optional; empty arrays use unknown[].

Updates as you type or change an option


    
Processed in this browser. Nothing is uploaded or saved.

About this tool

Infer TypeScript types from JSON samples, including nested objects, optional properties, arrays, unions and null.

How to use

Paste a representative JSON sample and choose a type name. Copy the generated export or download a .ts file. Array samples are combined: properties missing from some objects become optional and different value types form unions.

Empty arrays use unknown[] and empty objects use { [key: string]: unknown }. A sample cannot describe values it does not contain, so review the type against your API contract. Duplicate keys are rejected. Limits: 2 MiB, 30,000 values and 80 nested levels.

Comments

0
to join the discussion.
No comments yet.
Reply thread

Follow the complete conversation chronologically; each reply identifies the specific message it answers.