JSON to TypeScript Converter
Paste a JSON object or array, get a typed TypeScript interface back — instantly, in your browser.
Convert JSON to a TypeScript interface
Paste any JSON object or array. The interface regenerates as you type.
TypeScript output
interface Author {
name: string;
id: number;
}
interface Root {
id: string;
title: string;
published: boolean;
views: number;
tags: string[];
author: Author;
}How it works
Conversion runs entirely client-side: your JSON is parsed and walked in the browser to infer field types, with nested objects promoted to their own named interface. Nothing is uploaded or logged — this is the same structural-typing approach a schema-driven content API uses to generate a full client, just run on a single sample instead of a declared schema.
Get types generated from a real schema, not a sample
Draftbase generates a full typed client from your actual content schema via draftbase types — run in CI, so types never drift from what the API returns.
Hobby is free, no card. Startup is $49/mo when you outgrow it. The price is on the pricing page, where prices go.
No migration quarter, no kickoff workshop. Define a template and ship something today.
Frequently asked questions
How does JSON get converted to TypeScript?
The tool walks the parsed JSON value by value: primitives map to string, number, or boolean; arrays infer their element type from the first item; nested objects become their own named interface. It’s a structural inference from one sample, not a schema — fields that are sometimes absent or sometimes a different type won’t be caught.
Why does an empty array produce unknown[]?
An empty array carries no element to infer a type from, so unknown[] is the honest answer rather than a guess. Add a sample item to the array to get a real element type.
Is this safe for production types?
Treat the output as a starting point. It’s inferred from one JSON sample, so optional fields, unions, and enums won’t be detected — review and adjust before committing generated types.
More free tools on the tools page, or read the content modeling guide on /content-modeling.