summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI.Web/Startup.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/StardewModdingAPI.Web/Startup.cs b/src/StardewModdingAPI.Web/Startup.cs
index c1f03b34..2d9a95f1 100644
--- a/src/StardewModdingAPI.Web/Startup.cs
+++ b/src/StardewModdingAPI.Web/Startup.cs
@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
using StardewModdingAPI.Web.Framework;
namespace StardewModdingAPI.Web
@@ -44,6 +45,11 @@ namespace StardewModdingAPI.Web
// add support for comma-delimited parameters
ArrayModelBinderProvider arrayModelBinderProvider = options.ModelBinderProviders.OfType<ArrayModelBinderProvider>().First();
options.ModelBinderProviders.Insert(options.ModelBinderProviders.IndexOf(arrayModelBinderProvider), new CommaDelimitedModelBinderProvider());
+ })
+ .AddJsonOptions(options =>
+ {
+ // suppress null values in JSON responses
+ options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
});
}