public class providerData
{
String rowId { get; set; }
}
public class providerPagedData
{
public int total { get; set; }
public int totalPages { get; set; }
public List<providerData> items { get; set; }
}
public class ProviderTest
{
String converted = "{\"total\":5,\"totalPages\":0,\"items\":[{\"rowId\":\"#10479\"}]}";
public ProviderTest()
{
providerPagedData providers = new providerPagedData();
try
{
providerPagedData p = JsonSerializer.Deserialize <providerPagedData>(converted,
new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true,
}
);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
Result returns correct values for members "total" and totalPages, and correct number of "items", but "rowId" of the first element is always null. Can't figure out what I am doing wrong and will appreciate any advise/help