怎么在.net里面解析JSON文件
展开全部
str = str1 = "";
FileTimeInfo fi = GetLatestFileTimeInfo(txtFile, ".txt");
FileStream fs = new FileStream(fi.FileName, FileMode.Open);
using (StreamReader sr = new StreamReader(fs, Encoding.GetEncoding("gb2312")))
{
while ((str = sr.ReadLine()) != null)
{
str1 += str;
}
}
string a1, a2, b1, b2, aAll, bAll;
//string str = a;
JObject obj = (JObject)JsonConvert.DeserializeObject(str1.Replace(" ", ""));
JArray array = (JArray)obj["tighteningsteps"];
string s = array[0]["graph"].ToString();
JObject obj1 = (JObject)JsonConvert.DeserializeObject(s);
a1 = obj1["anglevalues"].ToString();
FileTimeInfo fi = GetLatestFileTimeInfo(txtFile, ".txt");
FileStream fs = new FileStream(fi.FileName, FileMode.Open);
using (StreamReader sr = new StreamReader(fs, Encoding.GetEncoding("gb2312")))
{
while ((str = sr.ReadLine()) != null)
{
str1 += str;
}
}
string a1, a2, b1, b2, aAll, bAll;
//string str = a;
JObject obj = (JObject)JsonConvert.DeserializeObject(str1.Replace(" ", ""));
JArray array = (JArray)obj["tighteningsteps"];
string s = array[0]["graph"].ToString();
JObject obj1 = (JObject)JsonConvert.DeserializeObject(s);
a1 = obj1["anglevalues"].ToString();
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询