我有一些问题DeSerializing下面的Json,它运行,没有抛出错误,但在类中的道具都是空的,所以它显然不工作。
{ "realms":[ { "type":"pve", "queue":false, "status":true, "population":"medium", "name":"Malfurion", "slug":"malfurion" } ] }上面的JSON是jsonResult字符串,所以字符串jsonResult =上面的JSON
我的代码:
public class Realm
{
public string type { get; set; }
public bool queue { get; set; }
public bool status { get; set; }
public string population { get; set; }
public string name { get; set; }
public string slug { get; set; }
}
var realm = javaScriptSerializer.Deserialize<Realm>(jsonResult);发布于 2011-07-23 00:12:39
该对象中没有道具,因为该对象包含一个数组,该数组中只有一个对象。
https://stackoverflow.com/questions/6792819
复制相似问题