下载Newtonsoft.Json,记得添加引用using Newtonsoft.Json.Linq;Jobject的内容格式如下:关键是怎么把user_list中的内容提取出来{
"error_code": 0,
"error_msg": "SUCCESS",
"log_id": 3014595066,
"timestamp": 1527234617,
"cached": 0,
"result": {
"face_token": "49d58eacd7811e463429a1ae10b42173",
"user_list": [
{
"group_id": "NR",
"user_id": "1028867728",
"user_info": "cactus0117",
"score": 97.499450683594
}
]
}
}//定义的类public class SearchFaceMatchInfo{ public JObject OriginInfo; public string error_code; public string error_msg; public string log_id; public string timestamp; public string cached; public string face_token; public string group_id; public string user_id; public string user_info; public float score;}bldxtz = new SearchFaceMatchInfo();SearchFaceMatchInfo.log_id = result.Value<string>("log_id");//log_idSearchFaceMatchInfo.timestamp = result.Value<string>("timestamp");//timestampSearchFaceMatchInfo.cached = result.Value<string>("cached");//cachedSearchFaceMatchInfo.cached = result["result"]["face_token"].ToString();//face_tokenJArray res = result["result"].Value<JArray>("user_list");JObject j = JObject.Parse(res[0].ToString());SearchFaceMatchInfo.group_id = j.Value<string>("group_id");//group_idSearchFaceMatchInfo.user_id = j.Value<string>("user_id");//user_idSearchFaceMatchInfo.user_info = j.Value<string>("user_info");//user_infoSearchFaceMatchInfo.score = j.Value<float>("score");//score