Cannot deserialize the current JSON object

israel bulseco May 15, 2017

Jira JSON Output

{"expand":"schema,names","startAt":0,"maxResults":50,"total":2350,"issues":[{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"1686803","self":"https://almtools/jira/rest/api/latest/issue/1686803","key":"TS-26271"},{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"1685941","self":"https://almtools/jira/rest/api/latest/issue/1685941","key":"TS-26268"},{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"1685807","self":"https://almtools/jira/rest/api/latest/issue/1685807","key":"TS-26266"}]}

Here's my code

    class IssueDetails
    {
        [JsonProperty("expand")]
        public string Expand { get; set; }

        [JsonProperty("startAt")]
        public int StartAt { get; set; }

        [JsonProperty("maxResults")]
        public int MaxResults { get; set; }

        [JsonProperty("total")]
        public int Total { get; set; }

        [JsonProperty("issues")]
        public List<Issues> IssueDescriptions { get; set; }

    
    }
    public class Issues
    {
        [JsonProperty("expand")]
        public string Expand { get; set; }
        
        [JsonProperty("id")]
        public int Id { get; set; }

        [JsonProperty("self")]
        public string Self { get; set; }

        [JsonProperty("key")]
        public string Key { get; set; }

    }

Im getting an error

{"Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.List`1[frmEquationBacklogList.IssueDetails]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath 'expand', line 1, position 10."}

1 answer

0 votes
Robert Massaioli _Atlassian_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 22, 2018
Edit: deleted

Suggest an answer

Log in or Sign up to answer