Get started
HomeDeveloper ToolsJSON to TS
Developer ToolsRuns in your browser · files never uploaded

JSON to TS

JSON → TypeScript interface

4.8· 50 votes
Your file never leaves this browser. Everything runs on your device — no uploads, no server storage, no retention.How it works →
JSON246 chars
TypeScript245 chars
export interface User {
  id: number;
  name: string;
  active: boolean;
  tags: string[];
}

export interface Post {
  id: number;
  title: string;
  views: number;
  pinned?: boolean;
}

export interface Root {
  user: User;
  posts: Post[];
}

What is JSON to TS?

Infer TypeScript interfaces from a sample JSON object. Handles nested objects (becoming nested interfaces), arrays of objects (merged into a single interface with optional fields for keys that vary), and primitive types. Produces clean, copy-pasteable TypeScript that you can drop into a types file.

How do I use JSON to TS?

  1. Paste sample JSON.
  2. Set the root type name.
  3. Copy or download the generated TypeScript.

When should I use JSON to TS?

JSON to TS speeds up API-client scaffolding. For Python's TypedDict equivalent, use JSON to Python. For producing a full validator (not just a type), use a schema library like Zod — this tool emits types only.

Frequently asked
How accurate are the generated types?

Very — we infer union types when arrays contain mixed shapes, mark optional fields that appear in some but not all objects, and handle null correctly.

Does it generate interfaces or type aliases?

You choose — interfaces by default, switch to type aliases for union-heavy schemas where interfaces feel awkward.

Can I name the root type?

Yes — enter a name at the top of the form. Nested types are named automatically (e.g. Root, RootUser, RootUserAddress).

Is my file uploaded anywhere?

No. Everything runs in your browser. Your files never leave your device, and there is no server component for this tool.

Related in Developer Tools
UUID Generator
Regex Tester
Cron Generator
Cron Parser
Timestamp Converter
Unix Time Converter
API Tester
Curl to Code