免费 · 开发
JSON 转 Pydantic 模型.
把 JSON 示例转换为 Pydantic v2 模型,字段使用 snake_case 并保留原键别名,支持可选字段和嵌套类。
Loading the calculator…
使用方法: JSON 转 Pydantic 模型
输入数据或选择文件,调整设置并生成结果。复制或下载之前,请检查结果。
限制与支持格式
输入内容在您的设备上处理。
英语技术说明
Types are inferred from the sample only. Everything is calculated in your browser; nothing you type is uploaded.
Fields missing from some array items or null in the sample become optional (X | None = None); integers and decimals merge to float; differing types become Any. Python keywords get a trailing underscore.
A user with isActive, an address and a list of orders becomes User, Address and Order models; isActive becomes is_active with alias "isActive".