需要将Json对象建模为C#

时间:2018-11-22 15:16:07

标签: c# json unity3d

我想在下面对json对象建模以便反序列化它。 我正在这样做。 如您所见,“结果”对象有2个名为332和402的对象

我的建议是:

[System.SerializeField]
public class Item
{
 public string name;
 public float size;
 public Result results;
}

[System.SerializeField]
public class Result
{
 public string 332; // i have troubles here , how to name this !
}

--------- Json对象----------

{
  "name": "data",
  "size": 4,
  "results": 
    {
      "332": 
      {
        "id": "332",
        "name": "",
        "description": "description here"
      },
      "402": 
      {
            "id": "332",
            "name": "",
            "description": "description here"
      }
    }
}

0 个答案:

没有答案