Dears,
I've saved all users in a portal to text file using
ArrayList userArray = UserController.GetUsers(portalid);
var settings = new JsonSerializerSettings();
settings.NullValueHandling = NullValueHandling.Ignore;
settings.DefaultValueHandling = DefaultValueHandling.Ignore;
string jsonData = JsonConvert.SerializeObject(userArray , settings);
sw.Write(jsonData);
sw.Close();
However, when I try to read from the json file to convert it to List<UserInfo> object, I got the following error "Error setting value to 'Title' on 'DotNetNuke.Entities.Users.UserProfile'"
the following is the conversion syntax
var settings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore
};
try
{
List<UserInfo> usr = JsonConvert.DeserializeObject<List<UserInfo>>(File.ReadAllText(@"D:\Users.txt"), settings);//this throws the error
}
catch(Exception ex)
{
Console.Write(ex.Message);
}
Any idea? pls help.