I have been trying to deserialize return response.Content string but in vain. WebApi action returns a modified modelState with additional custom errors.
On the MVC side, I tried the following methods none worked:
JsonDeserializer deserial = new JsonDeserializer();
var json = deserial.Deserialize<dynamic>(response);
And
var json = JsonConvert.DeserializeObject<WebApiReturnModel>(response.Content);
public class WebApiReturnModel
{
public string Message { get; set; }
public ModelStateDictionary ModelState { get; set; }
}
Example of response.Content returned:
{
"Message":"The request is invalid.",
"ModelState":{
"": ["Name Something is already taken.","Email '[email protected]' is already taken."]
}
}
How to get this to work?
ModelStateDictionarydesigned?