The Free Software Media System - Server Backend & API
Ignore null json values
crobibero340f83c3f5e0
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex 5bf740cfcc..48e2f5d4a1 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -90,6 +90,9 @@ namespace Emby.Server.Implementations.Data_typeMapper = new TypeMapper();_jsonOptions = JsonDefaults.GetOptions();+ // GetItem throws NotSupportedException with this enabled, so hardcode false.+ _jsonOptions.IgnoreNullValues = false;+DbFilePath = Path.Combine(_config.ApplicationPaths.DataPath, "library.db");}diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.csindex 2e2bfea684..1f9fc7078b 100644--- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs+++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs@@ -168,6 +168,8 @@ namespace Jellyfin.Server.Extensions// From JsonDefaultsoptions.JsonSerializerOptions.ReadCommentHandling = jsonOptions.ReadCommentHandling;options.JsonSerializerOptions.WriteIndented = jsonOptions.WriteIndented;+ options.JsonSerializerOptions.IgnoreNullValues = jsonOptions.IgnoreNullValues;+options.JsonSerializerOptions.Converters.Clear();foreach (var converter in jsonOptions.Converters){diff --git a/MediaBrowser.Common/Json/JsonDefaults.cs b/MediaBrowser.Common/Json/JsonDefaults.csindex 0a661934e5..891715b3da 100644--- a/MediaBrowser.Common/Json/JsonDefaults.cs+++ b/MediaBrowser.Common/Json/JsonDefaults.cs@@ -24,7 +24,8 @@ namespace MediaBrowser.Common.Jsonvar options = new JsonSerializerOptions{ReadCommentHandling = JsonCommentHandling.Disallow,- WriteIndented = false+ WriteIndented = false,+ IgnoreNullValues = true};options.Converters.Add(new JsonGuidConverter());