1

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?

1 Answer 1

1

I don't think Jayrock supports generic lists. Try using an AreaFieldItem array instead:

public class AreaField
{
  public AreaFieldItem[] AreaFieldItem { set; get; }
}
Sign up to request clarification or add additional context in comments.

1 Comment

Again a great question and answer downvoted to 0. This is the answer I was looking for.