Merge pull request #3961 from crobibero/api-json-null

Ignore null json values
This commit is contained in:
Bond-009 2020-08-23 16:27:24 +02:00 committed by GitHub
commit 7ce21d436b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -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");
}

View File

@ -168,6 +168,8 @@ namespace Jellyfin.Server.Extensions
// From JsonDefaults
options.JsonSerializerOptions.ReadCommentHandling = jsonOptions.ReadCommentHandling;
options.JsonSerializerOptions.WriteIndented = jsonOptions.WriteIndented;
options.JsonSerializerOptions.IgnoreNullValues = jsonOptions.IgnoreNullValues;
options.JsonSerializerOptions.Converters.Clear();
foreach (var converter in jsonOptions.Converters)
{

View File

@ -24,7 +24,8 @@ namespace MediaBrowser.Common.Json
var options = new JsonSerializerOptions
{
ReadCommentHandling = JsonCommentHandling.Disallow,
WriteIndented = false
WriteIndented = false,
IgnoreNullValues = true
};
options.Converters.Add(new JsonGuidConverter());