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
Backend devs, API integrators, anyone debugging JSON/YAML/CSV payloads or working with structured data.
FAQ
Is my sensitive data safe?
Yes. JSON/YAML/CSV you paste is NOT uploaded to any server. All processing happens locally in your browser.
Is there a size limit?
Browser RAM dependent. Files under 10MB run smoothly. Larger files may freeze the tab.
Related tools
See all tools →JWT Decoder
Decode JWT tokens — header, payload, claims with readable timestamps.
NEWJSON Formatter
Format / minify / validate JSON. Sort keys A-Z, custom indent, Ctrl+Enter shortcut.
NEWUUID / Hash / Base64 / URL
Bundle: UUID v4, SHA-256/512 hash, Base64 (URL-safe), URL encode.
NEWJSONPath Tester
Test JSONPath queries against JSON samples. Pick data from API responses, debug structured output. Recursive descent + filters.