Fireoa Tools 工具站
工具导航
站点地图
提交缺陷
English
分享当前页面
安装此页面为应用
免费在线 JSON 转 C# Class 工具
免费在线 JSON 转 C# Class:从样例 JSON 生成 C# 类与属性(可选 JsonPropertyName/nullable),纯前端本地运行。
免费在线JSON转C# Class工具,支持粘贴JSON样例并自动推断字段类型,生成C# POCO/类定义与属性,支持嵌套对象、数组(List<T>/T[])、可选字段与nullable引用类型,并可生成System.Text.Json的JsonPropertyName映射。纯前端本地运行不上传数据,适合接口响应建模、后端开发联调与快速生成模型代码。
根类型名
数组类型
List<T>
T[]
JsonPropertyName
Nullable 引用类型
格式化 JSON
复制 C# 代码
JSON 输入
{ "id": 1, "name": "Alice", "tags": ["a", "b"], "profile": { "email": "a@example.com" } }
说明:混合类型/混合数组会降级为
object
;字段缺失/为 null 会生成可空类型。
C# 输出
using System; using System.Collections.Generic; using System.Text.Json.Serialization; public class AutoGeneratedProfile { [JsonPropertyName("email")] public string Email { get; set; } = default!; } public class AutoGenerated { [JsonPropertyName("id")] public long Id { get; set; } [JsonPropertyName("name")] public string Name { get; set; } = default!; [JsonPropertyName("profile")] public AutoGeneratedProfile Profile { get; set; } = default!; [JsonPropertyName("tags")] public List<string> Tags { get; set; } = new(); }