下面展示一些
内联代码片
。
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()); }