I have the following class structure
public class AreaFields
{
public List<Fields> Fields { set; get; }
}
public class Fields
{
public string Name { set; get; }
public string Value {set; get; }
}
When I export to Json using Jayrock.Json.Conversion.JsonConvert.ExportToString(List<AreaField> obj)
, everything works fine. The problem is when I attempt to import it back to a list of AreaField, the native import fails. What I am trying to is
Jayrock.Json.Conversion.JsonConvert.Import(strJson)
Is there a way to maybe override the import method?
EDIT: Yes, jayrock knows the type of the object. My guess it has to do something with me serializing a list.
Export -
List<AreaField> list = GetAListOfAreaFields();
string sJson = Jayrock.Json.Conversion.JsonConvert.ExportToString(list)
Import -
List<AreaField> list = (AreaField)JsonConvert.Import(typeof(AreaField, sJson);
Exception - Cannot import AreaField from a JSON Array value.