Globally, in .NET Core 1.0 (all API responses), how can I configure Startup.cs so that empty fields are deleted / ignored in JSON responses?
Using Newtonsoft.Json, you can apply the following attribute to a property, but I would like not to add it to each of them:
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string FieldName { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string OtherName { get; set; }
source share