c# json对象中含有数组,数组中又含有数组!
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c# json对象中含有数组,数组中又含有数组!相关的知识,希望对你有一定的参考价值。
json对象中含有数组,数组中又含有数组!这不是问题,这些我能解析出来,但是有个巨大的问题,JSOn中数组中有嵌套了多个数组,这些数组没有可以用来检索的东西!!!!这些才问题,..这个是JSON代码这个是我直接读出来的,没有解析。
"errno":0,"data":"word_name":"\u597d","symbols":["ph_zh":"h\u01ceo","parts":["part":"\u5f62","means":["good","fine","nice"]],"ph_zh":"h\u00e0o","parts":["part":"\u52a8","means":["like","love","be fond of"],"part":"\u540d","means":["a surname"]]],"to":"en","from":"zh"
我能解析出来,但是我的解析缺是把全部的means和part解析出来了..我想单个解析 而不是全部解析出来
string result = string.Empty;
using (StreamReader sr = new StreamReader(File.Open(@"D:\csharp\output\output\data.json", FileMode.Open)))
result = sr.ReadToEnd();
JObject jo = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(result);
Console.WriteLine(jo["data"]["symbols"][0]["parts"][0]["means"][1].ToString());
Console.ReadLine();
data.json就是存放的
"errno":0,"data":"word_name":"\u597d","symbols":["ph_zh":"h\u01ceo","parts":["part":"\u5f62","means":["good","fine","nice"]],"ph_zh":"h\u00e0o","parts":["part":"\u52a8","means":["like","love","be fond of"],"part":"\u540d","means":["a surname"]]],"to":"en","from":"zh"本回答被提问者和网友采纳
以上是关于c# json对象中含有数组,数组中又含有数组!的主要内容,如果未能解决你的问题,请参考以下文章
python 一个二维数组和一个整数,判断数组中是否含有该整数