大家好,又见面了,我是你们的朋友全栈君。
string weixin2 = “”; weixin2 += “[{“; weixin2 += “\”Appkey\”:\”88\”,”; weixin2 += “\”OperationID\”:\”888\”,”; weixin2 += “\”Body\”:{“; weixin2 += “\”Xfxx\”:{“; weixin2 += “\”nsrsbh\”:\”88\”,”; weixin2 += “\”jqbh\”:\”888\””; weixin2 += “},”; weixin2 += “\”Xzxx\”:{“; weixin2 += “\”fpdm\”:\”666\”,”; weixin2 += “\”fphm\”:\”666\”,”; weixin2 += “\”jshj\”:\”666\”,”; weixin2 += “\”kprq\”:\”666\””; weixin2 += “}”; weixin2 += “}”; weixin2 += “}]”; List<JObject> jobInfoList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JObject>>(weixin2);
foreach (JObject jobInfo in jobInfoList) { Response.Write(“UserName:” + jobInfo.Appkey); Response.Write(“UserName:” + jobInfo.Body.Xzxx.fpdm); }
#region JObject 类 /// <summary> /// /// </summary> public class JObject { public string Appkey { get; set; } public string OperationID { get; set; } public Body Body { get; set; } } public class Body { public Xzxx Xzxx { get; set; } public Xfxx Xfxx { get; set; } } public class Xfxx { public string nsrsbh { get; set; } public string jqbh { get; set; } } public class Xzxx { public string fpdm { get; set; } public string fphm { get; set; } public string jshj { get; set; } public string kprq { get; set; } } #endregion
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/142974.html原文链接:https://javaforall.cn