JSON → TypeScript
貼任意 JSON,**即時推斷 TypeScript 型別** — 自動命名巢狀型別(`users → User`)、合併陣列內共同 shape、把缺漏欄位標為 optional、混合型別 array 推 union。可選 interface / type、根名稱、`readonly`。完全本地,JSON 不上傳。
›如何使用
- 把任意 JSON 貼進左側(API response、設定檔、fixture 都行)。
- 右側立刻產出 TypeScript
interface/type,巢狀型別會自動命名(如User_Address)。 - 陣列裡有多個 element shape 不同?工具自動合併 + 標
optional。 - 頂部選
readonly跟typevsinterface,一鍵複製到你的 SDK / model 檔。
Tips
- 想加 JSDoc 註解?先在 JSON 加
_doc欄位,我會放進產出的 type 裡。 - API response 有
null欄位 → 自動推成T | null,不會省略。