using Newtonsoft.Json; namespace HealthMonitor.WebApi.Extensions { public static class ObjectJsonConvertExt { public static string ToJson(this object target) { var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; return JsonConvert.SerializeObject(target, jsonSetting); } } }