ToolPal

JSON 转 TypeScript 接口生成器

将 JSON 对象即时转换为 TypeScript interface 或 type alias。处理嵌套对象、数组、null 和混合类型。

关键字
数组语法

使用方法

将 JSON 对象即时转换为 TypeScript interface 或 type alias。处理嵌套对象、数组、null 和混合类型。

  1. 1Paste your JSON object into the left panel, or click 'Load Sample' to try a pre-built example.
  2. 2Set the root interface name (default: Root), choose interface vs type, and adjust array syntax and optional field options.
  3. 3The right panel instantly shows the generated TypeScript interfaces as you type.
  4. 4Click 'Copy' to copy the complete TypeScript output to your clipboard.

主要功能

  • Generates separate named interfaces for all nested objects
  • Toggle between interface and type alias output
  • Choose T[] or Array<T> array syntax
  • Mark all fields as optional with a single toggle
  • Handles strings, numbers, booleans, null, arrays, and mixed-type unions
  • Real-time generation — no button clicks needed
  • 100% browser-based, your JSON never leaves your device

常见问题

了解更多