我想使用Newtonsoft将JSON数组反序列化为类。
JSON数组(Api返回)
[1,"1",true,2,3]
上课
class MyObject {
public int Number { get; set; }
public string Data { get; set; }
public bool IsIt { get; set; }
}
除了创建像
这样的构造函数之外,还有什么办法吗?public MyObject(object[] array) {
Number = (int)array[0];
Data = (string)array[1];
IsIt = (bool)array[2];
}