using System.ComponentModel;
public static void Main()
JsonSerializerSettings ser = new JsonSerializerSettings ();
ser.DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate;
var intObj = new ColorInfo() { ColorId=2, ColorName="Red",EffectiveDate = DateTime.MinValue, ColorCode=20 };
var strOut = JsonConvert.SerializeObject(intObj,ser);
Console.WriteLine(strOut);
var jsonInput ="{'ColorId':1,'ColorName':'Red','EffectiveDate':'0001-01-01T00:00:00'}";
var clsInfo = JsonConvert.DeserializeObject<ColorInfo>(jsonInput,ser);
Console.WriteLine(String.Format("Id : {0}, Name : {1}, Effective Date: {2}, ColorCode : {3}",
clsInfo.ColorId, clsInfo.ColorName, clsInfo.EffectiveDate, clsInfo.ColorCode));
public int ColorId {get;set;}
public string ColorName{get;set;}
public DateTime EffectiveDate{get;set;}
public int ColorCode{get;set;}