Posted on: 4/16/2014 8:56:07 AM | Views : 2325

Hello
I have an custom object that contains MailAddress objects as properties.
I serialize them using newtonsoft and everything works fine.
When I try to deserialize the object I get this error:
An unhandled exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in Newtonsoft.Json.dll Additional information: Unable to find a constructor to use for type System.Net.Mail.MailAddress. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path '[0].mailAddress.DisplayName', line 1, position 31. This is my test code:
MailAddress address1 = new MailAddress("test1@test.tes"); MailAddress address2 = new MailAddress("test2@test.tes"); MailAddress address3 = new MailAddress("test3@test.tes"); MyObj myObj1 = new ...

Go to the complete details ...