{
"aircraftNo": null,
"billNo": null,
"checkArea": null,
"checkCustomsCode": "3104"
}
定义:
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
或者
setting.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat;
//空值处理
setting.NullValueHandling = NullValueHandling.Ignore;
使用:
string messageOut = JsonConvert.SerializeObject(实体类, Formatting.Indented,jsonSetting);