13,347
社区成员
发帖
与我相关
我的任务
分享
public class myface
{
public string image_id { get; set; }
public string request_id { get; set; }
public string time_used { get; set; }
public faces[] faces { get; set; }
}
public class faces
{
public Attributes attributes { get; set; }
public string face_token { get; set; }
}
public class Attributes
{
public gender gender { get; set; }
public age age { get; set; }
public glass glass { get; set; }
public headpost headpost { get; set; }
public smile smail { get; set; }
}
public class gender
{
public string value { set; get; }
}
public class age
{
public string value { set; get; }
}
public class glass
{
public string value { set; get; }
}
public class headpost
{
public string value { set; get; }
}
public class smile
{
public string threshold { set; get; }
public string value { set; get; }
}
protected void Page_Load(object sender, EventArgs e)
{
string result = "{\"image_id\": \"LZqkfgZdaRVzQvwqnCWwCQ==\", \"request_id\": \"1479872923803e24e2-2f93-4e02-86ef-94321d74d575\",\"time_used\": 310,\"\faces\":[{\"attributes\":{\"gender\": {\"value\": \"Female\"},\"age\": {\"value\": 20}},\"\face_rectangle\":{\"width\":180,\"top\":91,\"left\":272,\"height\":181},\"face_token\":\"ff48424df99df8543b3c89781483101f\"}]}";
myface datas = JsonConvert.DeserializeObject<myface>(result);
foreach (faces faceslist in datas.faces)
{
string ages = faceslist.attributes.age.value;
}
}
我这么解析的,不知道为什么解析不了?楼上的二位!