I have list of json data i have deserialize in list of class object but if proerties name does not match with json data it takes value null.
Json data come from the url as user dependent user can enter any data then what i will do for validation to handle null when properties not match.
sampleJson list of data is like:
[{"adsname":"Francis","adsimageurl":"Andrew Love.jpg","ontop":false,"key":30012647,"onscan":true,"adscode":6689390,"brandname":{"adsbrand":"Beth Moon"},"category":"New ads","adsscription":"Weinstein Jacob Sutton","from":"2016-12-30T00:00:00","to":"2016-12-30T00:00:00"},{"adsname":"McKay","adsimageurl":"Lorraine Spencer.jpg","ontop":false,"key":136301519,"onscan":true,"adscode":346146503,"brandname":{"adsbrand":"Russell Warner"},"category":"New ads","adsscription":"Stanton Thomas Moran","from":"2016-12-30T00:00:00","to":"2016-12-30T00:00:00"},{"adsname":"Berger","adsimageurl":"Lois Norton.jpg","ontop":false,"key":32971839,"onscan":false,"adscode":334075948,"brandname":{"adsbrand":"Becky Park"},"category":"New ads","adsscription":"Gallagher Matthew Pitts","from":"2016-12-30T00:00:00","to":"2016-12-30T00:00:00"},{"adsname":"Boswell","adsimageurl":"Constance Scarborough.jpg","ontop":false,"key":183877654,"onscan":true,"adscode":230154009,"brandname":{"adsbrand":"Yvonne Hardy"},"category":"New ads","adsscription":"Riddle Nancy Atkins","from":"2016-12-30T00:00:00","to":"2016-12-30T00:00:00"}]
My model propeties class like
public class AdsImportEntity
{
[JsonProperty(PropertyName = "title")]
public string AdsTitle { get; set; }
[JsonProperty(PropertyName = "description")]
public string Description { get; set; }
[JsonProperty(PropertyName = "barcode")]
public string Barcode { get; set; }
[JsonProperty(PropertyName = "top")]
public bool? Top { get; set; }
[JsonProperty(PropertyName = "fromdatetime")]
public System.DateTime? FromDatetime { get; set; }
[JsonProperty(PropertyName = "todatetime")]
public DateTime? ToDatetime { get; set; }
[JsonProperty(PropertyName = "httpimageurl")]
public string HttpImageUrl { get; set; }
}
My Question is If In list of object if object all properties contain null value then remove from list.