JSON 转代码
粘贴 JSON 一键生成 TypeScript interface、Go struct、Java record、Rust serde、Python dataclass、C# record 与 JSON Schema,自动合并数组样本、可空字段、union 推断,本地处理不上传。
支持对象、数组、嵌套、null、混合类型 union
推断规则
对象类型 —— 顶层字段生成 Root; 嵌套字段用字段名 PascalCase 作类名;数组元素用字段名去 s 作类名(users → User)。
可选字段 —— 数组里同层多个对象字段做 union, 仅出现在部分样本的字段自动标 ? / omitempty / Option<T>。
null 值 —— 视为字段可选; TS 输出 T | null,Go 用 *T(本 MVP 简化用 interface), Rust 用 Option<T>,Python 用 Optional[T],值 None。
混合类型数组 —— [1, "a", null]在 TS 里 string | number | null;Go/Rust 无原生 union,退化成 interface / serde_json::Value, 建议在源端规范化数据。
保留字冲突 —— type / class / fn / try等会自动加后缀(typeValue / type_),Go/Rust 会挂 tag 保留原 key。
用着不太对,或者想要别的功能?