AI智能
改变未来

C#获取字符串对象

下面展示一些

内联代码片

string jsonText = \"{\'name\':\'test\',\'phone\':\'18888888888\',\'image\':[{\'name\':\'img1\',\'data\':\'data1\'},{\'name\':\'img2\',\'data\':\'data2\'},{\'name\':\'img3\',\'data\':\'data3\'}]}\";  JObject jo = (JObject)JsonConvert.DeserializeObject(jsonText);  string zone = jo[\"name\"].ToString();  string zone_en = jo[\"phone\"].ToString();  JArray jar = JArray.Parse(jo[\"image\"].ToString());  MessageBox.Show(zone);  MessageBox.Show(zone_en);  for (var i = 0; i < jar.Count; i++)  {  JObject j = JObject.Parse(jar[i].ToString());        MessageBox.Show(j[\"name\"].ToString());        MessageBox.Show(j[\"data\"].ToString());  }
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » C#获取字符串对象