您好我正在尝试在 C# 中解析 JSON 页面,但我似乎无法读取一些字符串,例如:
"versions": [
{
"date": 1340466559,
"dl_link": "http://dev.bukkit.org/media/files/599/534/NoSwear.jar",
"filename": "NoSwear.jar",
"game_builds": [
"CB 1.2.5-R4.0"
],
"hard_dependencies": [],
"md5": "d0ce03e817ede87a9f76f7dfa67a64cb",
"name": "NoSwear v5.1",
"soft_dependencies": [],
"status": "Semi-normal",
"type": "Release"
},
我怎么能读到呢?这是我现在拥有的代码,适用于除此之外的所有其他内容:
public static void GetMoreInfo(string plugin)
{
try
{
string url = "http://bukget.org/api/plugin/";
var wc = new WebClient();
var json = wc.DownloadString(url + plugin);
var moreInfo = JsonConvert.DeserializeObject<MoreInfo>(json);
foreach (var category in moreInfo.categories)
{
Categories += category + ", ";
}
Categories = Categories.Remove(Categories.Length - 2, 2);
}
catch (Exception)
{
}
finally
{
if (string.IsNullOrEmpty(Categories))
{
Categories = "No data found.";
}
}
}
public class MoreInfo
{
public string[] categories;
}