ITBox
⌘K
教程
全部站点
▾
Seanhan 主站
做有用的小工具
PDFBox
PDF 工具集
零上传、零追踪的 PDF 工具
ImgBox
图片工具集
零上传零追踪的图片工具
☀
EN
首页
›
JSON 转类型
切换工具
▾
专注
JSON 转类型
把 JSON 数据递归推断为 TypeScript / Go / Java / Kotlin 的类型定义,自动命名嵌套类型、合并数组对象字段、识别可空字段。
目标语言
TypeScript
Go
Java
Kotlin
根类型名
null 值 → 可选 / 可空
JSON 输入
示例
清空
{ "id": 1024, "name": "Ada Lovelace", "active": true, "score": 98.5, "middleName": null, "address": { "city": "London", "zip": "EC1A", "geo": { "lat": 51.5, "lng": -0.12 } }, "roles": ["admin", "author"], "posts": [ { "title": "Hello", "views": 12, "pinned": true }, { "title": "World", "views": 30 } ] }
344 chars · 17 lines
TypeScript 接口
⧉
复制
interface Root2 { id: number; name: string; active: boolean; score: number; middleName?: null | null; address: Root2Address; roles: string[]; posts: Root2Post[]; } interface Root2Address { city: string; zip: string; geo: Root2AddressGeo; } interface Root2AddressGeo { lat: number; lng: number; } interface Root2Post { title: string; views: number; pinned?: boolean | null; }
441 chars · 27 lines