JSON to TypeScript Interface Generator
Convert JSON samples to TypeScript interfaces. Supports nested objects, arrays, optional/readonly. Great for API responses and LLM structured output.
Options
Convert a JSON sample into a TypeScript interface — perfect for API response shapes, LLM structured output, and mock data. 100% browser-side.
Why generate TypeScript from JSON?
- API response typing: receive JSON from a backend → auto-generate types for the frontend, no manual typing.
- LLM structured output: Claude / OpenAI / Gemini all support structured output by schema. Design a JSON sample, use this tool to get TS, then validate with Zod or Valibot.
- Mock data: have fake data → generate an interface to type-check your tests.
- Refactor: legacy JS codebase → migrate to TS, paste a JSON sample to get the interface instantly.
Features
- Nested types split out: JSON with sub-objects → the tool generates a separate interface per level.
- Inline mode: keep everything in one interface — toggle the option.
- Array → homogeneous type:
["a","b"]→string[]. Mixed →Array<string | number>. - readonly / optional: apply to all fields — useful for immutable API responses or form inputs.
- export keyword: paste straight into a .ts file.
Real-world example with the Claude API
Want Claude to return a structured response? Start with a JSON sample:
{
"summary": "An article about AI",
"topics": ["LLM", "RAG"],
"sentiment": "positive",
"actionItems": [
{ "task": "read more", "priority": "high" }
]
} The tool generates:
export interface ActionItem {
task: string;
priority: string;
}
export interface Root {
summary: string;
topics: string[];
sentiment: string;
actionItems: ActionItem[];
} Use with Zod to validate the response:
import { z } from 'zod';
const ActionItemSchema = z.object({
task: z.string(),
priority: z.string(),
});
const RootSchema = z.object({
summary: z.string(),
topics: z.array(z.string()),
sentiment: z.string(),
actionItems: z.array(ActionItemSchema),
}); Who this is for
Fullstack/backend/devops engineers — debug JWT, format JSON/SQL, parse cURL, compute CIDR subnets, draft Mermaid diagrams, write conventional commits… Daily toolkit alongside your terminal and editor.
FAQ
Is my pasted code/token sent anywhere?
No. All TopDev dev tools run 100% client-side — JWT, SQL, JSON, cURL, regex… process in-browser. Disconnect to verify. Safe for internal tokens, production DB queries, API keys.
Does it work offline / install as a PWA?
Tools work offline after the first load. Installable PWA is on the roadmap — for now you can bookmark and use without internet.
Related tools
See all tools →JWT Decoder
Decode JWT tokens — header, payload, claims with readable timestamps.
NEWText Diff
Paste 2 texts → highlight diffs at word/line/char level. Great for diffing AI outputs.
NEWJSON Schema Generator
Generate JSON Schema (Draft-07) from a sample — for LLM structured output and API validation.
NEWJSON Formatter
Format / minify / validate JSON. Sort keys A-Z, custom indent, Ctrl+Enter shortcut.