I am trying to deserilaize json to a c# class. I am not sure how I can get the ErrorContent into Dictionary of key value pair? Since Error Content is not an array, can I still convert it to Dictionary?
When I try below code, I keep getting ErrorContent as null..
var response = JsonConvert.DeserializeObject<SearchResponse>(jsonResponse);
The class Search Response looks like
public class SearchResponse
{
public ErrorContent Errors { get; set; }
}
public class ErrorContent
{
public Dictionary<int, string> Errors { get; set; } = new Dictionary<int, string>();
}
Sample json looks like
{
"statusCode": 1233, "status": "ERROR", "payloadType": "ERROR", "payload": {
"ErrorContent":{
"101": "Value cannot be null",
"102": "Value should always be integer"
}}}