不能弄清楚我反序列化的地方有錯嗎?JSON反序列化類
C#JSON類:
AllProjects [] AllProjectsList;
public class AllProjects
{
public Project [] Projects { get; set; }
}
public class Project
{
[JsonProperty("self")]
public string self { get; set; }
[JsonProperty("id")]
public string id { get; set; }
[JsonProperty("key")]
public string key { get; set; }
[JsonProperty("name")]
public string name { get; set; }
[JsonProperty("avatarUrls")]
public Dictionary<string, string> Result { get; set; }
}
我的JSON字符串:
[{
"self":"https://test.test.com/rest/api/2/project/AAAVOA",
"id":"11211",
"key":"AAAVOA",
"name":"AAA VOA",
"avatarUrls":
{
"16x16":"https://test.test.com/secure/projectavatar?size=small&pid=11211&avatarId=10281",
"48x48":"https://test.test.com/secure/projectavatar?pid=11211&avatarId=10281"
}
},
{
"self": ...
和反序列化代碼:
AllProjectsList = JsonConvert.DeserializeObject<AllProjects>(response.Content) as AllProjects;
我們也不能,因爲你沒有告訴我們你得到了什麼錯誤:)請更新問題以添加你得到的特定異常。 – Adrian