Okay, this
{
"Type": "abc",
"Filepath": "D:\\abc.doc"
}
deserializes to this:
public class Example
{
public string Type { get; set; }
public string Filepath { get; set; }
}
And this
{
"Type": "abc",
"Filepath": ["D:\\abc1.doc","D:\\abc2.doc"]
}
deserializes to this:
public class Example
{
public string Type { get; set; }
public IList<string> Filepath { get; set; }
}
So the error that you are seeing:
"Could not cast or convert from System.String to System.Collections.Generic.IList`1[System.String].]".
Should now have more meaning. So you
can not deserialize this:
{
"Type": "abc",
"Filepath": "D:\\abc.doc"
}
to this:
public class Example
{
public string Type { get; set; }
public IList<string> Filepath { get; set; }
}
For more information on working with deserializing JSON, check out this article:
Working with JSON in C# & VB[
^]