I have the below JSON:
"value": [
{
"testPlan": {
"id": 70531,
"name": "Test 123"
},
"project": {
"id": "4442886c-4116-46e4-943c-c72810958186",
"name": "MyTestProject",
"state": "unchanged",
"visibility": "unchanged",
"lastUpdateTime": "0001-01-01T00:00:00"
},
"testSuite": {
"id": 435353,
"name": "Reports"
},
"workItem": {
"id": 65434,
"name": "xxxxxx",
"workItemFields": [
{
"Microsoft.VSTS.Common.ActivatedBy": "xxxxx"
},
{
"Microsoft.VSTS.Common.ActivatedDate": "2022-02-14T06:11:19.433Z"
},
{
"Microsoft.VSTS.TCM.AutomationStatus": "Not Automated"
},
{
"System.State": "Design"
},
{
"System.AssignedTo": "yyyyy"
},
{
"Microsoft.VSTS.Common.Priority": 1
},
{
"Microsoft.VSTS.Common.StateChangeDate": "2022-02-14T06:11:19.433Z"
},
{
"System.WorkItemType": "Test Case"
},
{
"System.Rev": 4
}
]
}
}
},
{
"testPlan": {
"id": 70531,
"name": "Test 123"
},
"project": {
"id": "4442886c-4116-46e4-943c-c72810958186",
"name": "MyTestProject",
"state": "unchanged",
"visibility": "unchanged",
"lastUpdateTime": "0001-01-01T00:00:00"
},
"testSuite": {
"id": 435353,
"name": "Reports"
},
"workItem": {
"id": 65434,
"name": "xxxxxx",
"workItemFields": [
{
"Microsoft.VSTS.Common.ActivatedBy": "xxxxx"
},
{
"Microsoft.VSTS.Common.ActivatedDate": "2022-02-14T06:11:19.433Z"
},
{
"Microsoft.VSTS.TCM.AutomationStatus": "Not Automated"
},
{
"System.State": "Design"
},
{
"System.AssignedTo": "yyyyy"
},
{
"Microsoft.VSTS.Common.Priority": 1
},
{
"Microsoft.VSTS.Common.StateChangeDate": "2022-02-14T06:11:19.433Z"
},
{
"System.WorkItemType": "Test Case"
},
{
"System.Rev": 4
}
]
}
}
}
]
And this is my code – where casesResponseBody has the JSON:
string casesResponseBody = await casesResponse.Content.ReadAsStringAsync();
dynamic casesJsonResponse = JsonConvert.DeserializeObject<List<dynamic>>(casesResponseBody);
I am getting the error below – anything is wrong with my code?
{“Cannot deserialize the current JSON object (e.g. {“name”:”value”}) into type ‘System.Collections.Generic.List`1[System.Object]’ because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly
2