Loading…
Generate TypeScript interfaces from JSON with optional readonly and export. Use for TS types; for Go use json-to-go, for generic code use json-to-code. Input: JSON ≤10MB. Returns .ts interfaces or JSON error. 100% client-side.
JSON to TypeScript is loading — interactive editor will appear here. Use examples below to try instantly once loaded.
Press ? for keyboard shortcuts
Converts JSON input into TypeScript interfaces or type aliases with full support for nested objects, arrays, union types from varying structures, and nullable fields. Offers toggles for optional properties, readonly modifiers, export keywords, and JSDoc comments.
TypeScript developers frequently need type definitions for JSON API responses, configuration files, or data payloads. Manual typing is repetitive and error-prone, especially when dealing with large or nested JSON structures with optional fields.
This tool is part of the DevStackIO platform — a collection of free online developer tools from DevStackIO. Browse more free developer resources on DevStackIO.
TypeScript and Angular/React/Vue developers who need to quickly generate type definitions from JSON samples or API documentation.
Paste your JSON into the input editor; the tool parses the structure and infers types automatically
Select whether to generate interfaces (extends-friendly) or type aliases (union-friendly)
Toggle optional properties ON to mark all fields as optional with ? syntax, or OFF for required fields
Enable readonly modifiers to make all properties readonly, useful for immutable data patterns
Toggle "export" to prefix each type with the export keyword, and JSDoc for generating doc comments
Click "Generate" and review the output; copy the generated TypeScript types to your project
Input: {"id":1,"name":"Alice","roles":["admin"]} -> Output: export interface User { id: number; name: string; roles: string[]; }Input: [{"type":"cat","meow":true},{"type":"dog","bark":true}] with union detection -> Output: export type Animal = Cat | Dog; export interface Cat { type: string; meow: boolean; } export interface Dog { type: string; bark: boolean; }Can it generate types for deeply nested JSON?
Yes, nested objects become nested interfaces with proper hierarchical structure.
How does it handle arrays with different element types?
Arrays are typed as union types (e.g., (string | number)[]) when elements have mixed types.
Does it support generating enums from string literals?
Not automatically; you'll need to manually create enums from generated string literal unions.
What happens with empty objects or arrays?
Empty objects become Record<string, any> and empty arrays become any[] as fallback types.
Authoritative specifications, standards, and in-depth reading for JSON to TypeScript.
Generate code types from JSON. Use for boilerplate; for TS only use json-to-typescript, for Go use json-to-go. Input: JSON ≤10MB. Returns code. 100% client-side, files never leave browser.
Generate Go structs with json tags from JSON. Use for Go only; for TypeScript use json-to-typescript. Input: JSON ≤10MB. Returns Go code or JSON error. 100% client-side.
Extract HTML tables to JSON arrays for scraping. Use for <table> input only; for CSV to JSON use csv-to-json. Input: HTML with tables ≤10MB. Returns JSON array or NO_TABLE_FOUND error. 100% client-side.
Convert between TOML, JSON, and YAML in any direction. Use for multi-format configs; for single-pair JSON-YAML use json-to-yaml. Input: TOML/JSON/YAML ≤10MB. Returns converted text or parse error. 100% client-side.
Shows Unicode code points, names and UTF-8 bytes for any text. Use when debugging encoding issues; differs from nato-alphabet by code points vs phonetic words. Returns per-character table with escapes. 100% client-side.
Spells numbers as English words with currency and ordinal options. Use for cheques, invoices or legal text; differs from text-to-unicode by words vs code points. Returns word form and copy-ready text. 100% client-side.
Spells text as NATO phonetic words (Alpha, Bravo, Charlie). Use when dictating over calls; differs from text-to-unicode by spoken words vs code points. Returns phonetic transcription. 100% client-side.
Convert Unix timestamps to readable dates and back. Supports timezones and multiple formats.