C#- десериализация json в объект
Hi..I have an issue with json serialization which throws the error: "Could not cast or convert from System.String to System.Collections.Generic.IList`1[System.String].]". My json: "{\"Type\": \"abc\",\"Filepath\": \"D:\\\\abc.doc\"}"; My class: public class Arguments { public string Type { get; set; } public IList Filepath { get; set; } } My code to deserialize: var jsonObj = new JavaScriptSerializer().Deserialize(json); Can you help me understand the issue? I have made it a list as there can be situation to receive multiple objects and hence it is required. Would be great if you can help me! It works fine when i have multiple values, ie: "{\"Type\": \"abc\",\"Filepath\": [\"D:\\\\abc1.doc\",\"D:\\\\abc2.doc\"]}"; I want it to work fine in both ways.
Что я уже пробовал:
My code to deserialize: var jsonObj = new JavaScriptSerializer().Deserialize(json);