JSON to TypeScript
Infer a TypeScript type from a JSON example.
How to use JSON to TypeScript
Infer a TypeScript type from a representative JSON sample. Arrays become unions when sample values have different types. Object keys are quoted to preserve unusual names.
- Select Load example or paste your own test input.
- Choose Generate and review the available options.
- Run the selected action; review any validation message.
- Inspect the output before copying, printing or downloading it.
A small example
{"name":"Kishan","active":true}
→ export type Root = { "name": string; "active": boolean; };When the result looks wrong
This describes the sample, not a complete API contract. A null example cannot reveal the eventual non-null type. Empty arrays become unknown[]. Maximum nesting is 30 levels.
Questions about JSON to TypeScript
Is my input uploaded?
File and text processing runs in your browser. Opening the website still loads application assets from its host.
What if the result looks wrong?
This describes the sample, not a complete API contract. A null example cannot reveal the eventual non-null type. Empty arrays become unknown[]. Maximum nesting is 30 levels.
Can I use sensitive production data?
Prefer non-sensitive test data. Never paste live access tokens, passwords or confidential documents into a site without assessing its code and environment.
Supported input and output
Text input; check the selected action and example for the expected syntax.
See the result panel and available copy or download controls for the selected action.
