C
C#2y ago
riskal

✅ Work Items List deserialization returns null in Title and Description

Class:
namespace Service.AzureDevops
{
public class Fields
{
[JsonPropertyName("System.Title")]
public string Title { get; set; }
[JsonPropertyName("System.Description")]
public string Description { get; set; }
}
public class Value
{
[JsonPropertyName("id")]
public int ID { get; set; }
[JsonPropertyName("fields")]
public Fields Fields { get; set; }
[JsonPropertyName("url")]
public string Url { get; set; }
}
public class RootWorkItems
{
[JsonPropertyName("value")]
public List<Value> Value { get; set; }
}
}
namespace Service.AzureDevops
{
public class Fields
{
[JsonPropertyName("System.Title")]
public string Title { get; set; }
[JsonPropertyName("System.Description")]
public string Description { get; set; }
}
public class Value
{
[JsonPropertyName("id")]
public int ID { get; set; }
[JsonPropertyName("fields")]
public Fields Fields { get; set; }
[JsonPropertyName("url")]
public string Url { get; set; }
}
public class RootWorkItems
{
[JsonPropertyName("value")]
public List<Value> Value { get; set; }
}
}
Deserialization:
lRootWorkItems = JsonConvert.DeserializeObject<RootWorkItems>(lResponseBody);
lRootWorkItems = JsonConvert.DeserializeObject<RootWorkItems>(lResponseBody);
5 Replies
Anton
Anton2y ago
show the response body you get
riskal
riskalOP2y ago
Work Items - List - REST API (Azure DevOps Work Item Tracking)
Learn more about Work Item Tracking service - Returns a list of work items (Maximum 200)
Anton
Anton2y ago
Stack Overflow
Deserialize JSON with dot in property name
I am trying to deserialize JSON with dots in the property names into a key-value format. I am using the inbuilt ASP.NET MVC model binding. It seems to be interpreting the dots as a object notation
Anton
Anton2y ago
ah yikes that's exactly what you're doing and apparently that's a regression in the new version your code looks right tho the problem most likely has to do with the dots in the property names
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity. Closed!
Want results from more Discord servers?
Add your server