JSON to TypeScript
Paste a JSON payload, get TypeScript interfaces you would actually keep: nested objects become named interfaces, arrays union their member types, structurally identical shapes share one name, and null stays visible instead of becoming any.
From one sample, honestly
Inference from a single payload can only see what that payload shows: a field that is sometimes absent looks mandatory, a number that is sometimes a string looks like a number. The generated code is therefore a first draft with the structure done — names, nesting, arrays, quoting of hostile keys — leaving you the judgement calls no tool should make silently.
Everything happens in this tab, which matters precisely because real payloads carry real data: tokens, emails, order histories. A codegen page that uploads your JSON to "process" it has read your production data; this one structurally cannot.
Frequently asked questions
How are arrays typed?
By looking at every element, not just the first: [1, 2] becomes number[], [1, "x"] becomes (number | string)[], and an empty array becomes unknown[] — a visible admission rather than a silent any that turns off checking downstream.
What happens with repeated shapes?
Structurally identical objects share one interface: a list of users produces a single User referenced everywhere, not User, User2, User3. Different shapes with the same key name get numbered instead of merged — merging would hide real differences.
Why does null appear literally?
Because your API really sends it. A field typed string | null forces callers to handle the case; a field silently widened to any hides it until production. If a null field is optional in truth, tighten the type by hand — the tool refuses to guess.
Can it mark fields optional from multiple samples?
Not yet — one sample in, one honest draft out. Paste an array of several objects and the union types will already reveal the fields that vary; turning that into ?-marks is a planned refinement.
Related tools
- Diagram & Flowchart MakerDraw flowcharts and diagrams, connect the boxes with arrows that route themselves, and let it arrange the whole thing. Exports SVG. Nothing is uploaded.
- Password GeneratorGenerate strong random passwords using your browser's cryptographic RNG, with a live strength estimate.
- HTML Entity EncoderEncode text for HTML or decode entities back — the five markup breakers, named Latin-1 and symbol sets, numeric references up to emoji. Decodes exactly once.