← All Tools
JSON To Typescript Converter🔒 100% local
Convert JSON to TS interfaces. Privacy-first, no server uploads, no tracking.
Generates TypeScript from a JSON document: one interface per object shape found in the sample, plus an export type Root alias for the whole document. Property names that are not valid identifiers get quoted, arrays become T[] or a parenthesised union when the elements differ, and an empty array becomes unknown[]. Everything is derived from the text you paste, in the page.
How to use it
- Paste JSON - an object or an array of objects both work.
- Run the conversion.
- Copy the interfaces into your project and tighten the loose types by hand.
Worked example
[{"id":1,"name":"Ada"}]becomes// Generated by Blank2Done JSON → TypeScript (runs 100% locally)
interface RootItem {
id: number;
name: string;
}
export type Root = RootItem[];An array root is named RootItem and aliased to Root - the first output line is emitted by the tool exactly as shown. Every string is typed string, so dates, UUIDs and enums stay string until you change them.
When to use it
- Adding types to a fetch call whose response you have already captured.
- Turning a JSON config or fixture into interfaces so a parser stops using any.
- Getting a starting point you then narrow - a union of literals, an optional field, a branded ID type.
What it does not do
- Types come from one sample: null contributes a bare null rather than making the field optional, and a number that happens to be integral is still number.
- When the root is a JSON object the generated alias reads export type Root = Root;, a self-referential name you will want to rename - the interface above it is the part to keep.
- Array elements with different shapes each produce their own interface, and only byte-identical duplicates are removed, so two variants under the same key yield two interface RootItem blocks that TypeScript rejects as a duplicate identifier.