我正在尝试构建 Mike Jansen 的JIRA REST Client,并且我正在尝试获取 JIRA 版本信息。我是 JSON 新手,所以我不确定这只是格式问题还是什么。
调试时,我有以下令牌:
{[
{
"self": "https://<company>.atlassian.net/rest/api/2/version/10101",
"id": "10101",
"name": "2012.3",
"archived": false,
"released": false,
"releaseDate": "2012-10-08"
},
{
"self": "https://<company>.atlassian.net/rest/api/2/version/10200",
"id": "10200",
"name": "2012.4",
"archived": false,
"released": false
}
]}
和下面的代码行
token.Children().Values<T>()
抛出以下错误
Cannot cast Newtonsoft.Json.Linq.JProperty to Newtonsoft.Json.Linq.JToken
在尝试将两个版本标记转换为相应的 JiraVersion 类时:
using System;
namespace JiraRestClient
{
public class JiraVersion : JiraObjectBase, IJiraVersion
{
public JiraVersion(IJiraRestResponse jiraResponse) : base(jiraResponse) { }
public string Id { get { return Get<string>("Id", "id"); } }
public string Name { get { return Get<string>("Name", "name"); } }
}
}
有人可以帮帮我吗?