110,533
社区成员
发帖
与我相关
我的任务
分享
string json = "{" +
"\"student\": {" +
"\"abb\": {" +
"\"name\": \"aab\"," +
"\"url\": \"http://www.google.com\"" +
"}," +
"\"bba\": {" +
"\"name\": \"bba\"," +
"\"url\": \"http://www.baidu.com\"" +
"}," +
"\"cca\": {" +
"\"name\": \"cca\"," +
"\"url\": \"http://www.SoSo.com\"" +
"}" +
"}" +
"}";
var q = JObject.Parse(json)["student"].SelectMany(x => x.Select(y => new { name = y["name"], url = y["url"] }));
foreach (var item in q)
{
Console.WriteLine(item.name);
Console.WriteLine(item.url);
Console.WriteLine("=====================");
}
Console.ReadKey();