Reputation:
I am attempting to import a Json string by using:
AreaField areaField = new AreaField();
areaField = (AreaField) JsonConvert.Import(typeof(AreaField), HdnData.Value);
The class definition is as follows:
public class AreaField
{
public List<AreaFieldItem> AreaFieldItem { get; set; }
}
public class AreaFieldItem
{
public string Name { get; set; }
public bool Required { get; set; }
}
I get the error:
Cannot import System.Collections.Generic.List`1[FieldItem] from a JSON Array value.
I guess the native implementation of Import does not handle Lists? Do I have deserialize this myself?
Upvotes: 1
Views: 822
Reputation: 1187
I don't think Jayrock supports generic lists. Try using an AreaFieldItem array instead:
public class AreaField
{
public AreaFieldItem[] AreaFieldItem { set; get; }
}
Upvotes: 1