May 27, 2010 at 3:16 PM
Edited May 27, 2010 at 5:51 PM
Thanks James...looks like values are now now properly set to null. I opted to go the code route rather then the property attribute route as that way you do not have to go mark all your class properties if you have a ton of classes:
// Setup JSON.Net Serializer object properties
Newtonsoft.Json.JsonSerializerSettings jsonSettings = new Newtonsoft.Json.JsonSerializerSettings();
jsonSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
jsonSettings.MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore;
BO.UserProfile oUserProfile = JsonConvert.DeserializeObject(context.Request["profile"], jsonSettings);
However, I am still unable to mark a property with the DefaultValue("") attribute. Using VS 2010 with ref to Newtonsoft.Json.dll. Have following using statements in class:
I have tried to mark a property like so:
public DateTime? DateOfBirth
but it doesn't like it....immediately throws errors about the Type or Namespace not being found. Am I missing a ref, or is this not JSON.net attribute? Have not used that attribute before so it could be a .Net one and I am missing the ref to
the assembly it is included in.
Thanks for you timely responsiveness James, that is good stuff!
UPDATE: Ok, I got it....System.ComponentModel. Thanks again James for your diligent work and great response times to the community!