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(); } }
持續完善更新中,敬請期待...