json分分快三计划

作者:编程技术

//数据
string html = "{"code":"0000","desc":"","data": {"token": "1234567899654"}}";
//解析
JsonObject jo = (JsonObject)SimpleJson.DeserializeObject(html);
string code = jo["code"].ToString();
if (code.Equals("0000"))
{
JsonObject jar = (JsonObject) SimpleJson.DeserializeObject(jo["data"].ToString());
string token = jar["token"].ToString();
}

  string zone_en = jo["phone"].ToString();

JObject monitorinfo = (JObject)JsonConvert.DeserializeObject(responseContent);
JArray jar = JArray.Parse(monitorinfo["data"].ToString());
string emsg = string.Empty;

         JObject j = JObject.Parse(jar[i].ToString());

using Newtonsoft.Json;

  for (var i = 0; i < jar.Count; i )

 

  {   

mod.Success = Convert.ToBoolean(monitorinfo["success"]) ? 1 : 0;
if (mod.Success == 0)
{
mod.ReasonCode = monitorinfo["reason_code"].ToString();
mod.ReasonDesc = monitorinfo["reason_desc"].ToString();
}

第一便是采取了JArray.Parse。

 

  string zone = jo["name"].ToString();

 

  string jsonText = "{'name':'test','phone':'18888888888','image':[{'name':'img1','data':'data1'},{'name':'img2','data':'data2'},{'name':'img3','data':'data3'}]}";

JObject json = (JObject)JsonConvert.DeserializeObject(json);

  JArray jar = JArray.Parse(jo["image"].ToString());

 

json比相似格式再复杂点的就好像数组同样,有多层嵌套,研讨了一晃,记录代码如下:

using Newtonsoft.Json.Linq;

  MessageBox.Show(zone_en);

 

  }

public class modGREYLIST : modCommonField
{
public string evidence_type { get; set; }
public string risk_level { get; set; }
public JArray risk_type { get; set; }
public string monitor_field_zh { get; set; }
public string evidence_type_zh { get; set; }
public string risk_level_zh { get; set; }
public JArray risk_type_zh { get; set; }
}

  MessageBox.Show(zone);

modBLACKLIST mod1 = JsonConvert.DeserializeObject<modBLACKLIST>(risklist[j].ToString());

        MessageBox.Show(j["name"].ToString());

        MessageBox.Show(j["data"].ToString());

  JObject jo = (JObject)JsonConvert.DeserializeObject(jsonText);

本文由分分快三计划发布,转载请注明来源

关键词: 分分快三计划 C#