我选

我选

办公所需全收藏

JSON转C#

将JSON数据转换为C#类

工具说明

此工具可以将JSON数据转换为C#类,支持自定义类名、命名空间、属性访问修饰符、JSON属性标签等功能。生成的代码可以直接复制到C#项目中使用,提高开发效率。

使用场景

  • API开发中快速生成请求/响应模型
  • 解析JSON配置文件时生成对应数据结构
  • 学习C#类和属性的定义
  • 批量处理JSON数据时使用

示例JSON

用户信息
{
  "id": 1,
  "name": "John Doe",
  "email": "john@example.com",
  "age": 30,
  "isActive": true,
  "roles": ["admin", "user"],
  "address": {
    "street": "123 Main St",
    "city": "New York",
    "zipCode": "10001"
  }
}
API响应
{
  "success": true,
  "data": {
    "items": [
      {
        "id": "123",
        "title": "Product 1",
        "price": 99.99
      }
    ],
    "total": 1,
    "page": 1,
    "pageSize": 10
  },
  "error": null,
  "timestamp": 1634567890
}