1、解析简单Json字符串
if (l_sSenJson != "") { JObject obj2 = (JObject)JsonConvert.DeserializeObject(l_sSenJson); //执行反序列化 if (obj2["ResultStatus"].ToString() == "true") { JObject obj3 = (JObject)JsonConvert.DeserializeObject(l_sReval); //执行反序列化 if (obj3["bSuccessFlag"].ToString() == "-1") { } } }
2、从Json字符串中解析Json数组
//解析返回的json字符串 JObject obj = (JObject)JsonConvert.DeserializeObject(sReStringX); //执行反序列化 if (obj["ResultStatus"].ToString() == "true") { JArray ja0 = (JArray)obj["ItemFtpDetail"]; foreach (JObject item0 in ja0) { l_nIndex = item0["nIndex"].ToString(); l_sText = item0["sText"].ToString(); } }
持续更新中,敬请期待...
时间: 2024-12-21 02:36:37