.net 对json数据进行读取

TextReader file = new StringReader(info);
using (JsonTextReader reader = new JsonTextReader(file))
{
JObject json = (JObject)JToken.ReadFrom(reader);

JToken data = json["data"];
//遍历data中所有的课程,取details节点
foreach (JObject node in data)
{
//JObject details = (JObject)node["subject"];

//var deviceID = details["id"];
//var title = details["title"];
//var thumb = details["thumb"];
//var xiangqing=details["xiangqing"];


text += "标题:"+node["subject"] + "<br>" +"公告ID:"+node["notifyId"];
}
}

posted on 2020-01-15 19:01  菜鸟也想上天  阅读(1917)  评论(0编辑  收藏  举报