Skip to content

The Free Software Media System - Server Backend & API

Updated to latest unstable.

BaronGreenback889e98816786
diff --cc MediaBrowser.Common/Json/JsonDefaults.cs
index f232ebdc7f,1ec2a87c53..2b5f04cf82
--- a/MediaBrowser.Common/Json/JsonDefaults.cs
+++ b/MediaBrowser.Common/Json/JsonDefaults.cs
@@@ -19,6 -19,39 +19,40 @@@ namespace MediaBrowser.Common.Jso
/// </summary>
public const string CamelCaseMediaType = "application/json; profile=\"CamelCase\"";
+ /// <summary>
+ /// When changing these options, update
+ /// Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
+ /// -> AddJellyfinApi
+ /// -> AddJsonOptions.
+ /// </summary>
+ private static readonly JsonSerializerOptions _jsonSerializerOptions = new ()
+ {
+ ReadCommentHandling = JsonCommentHandling.Disallow,
+ WriteIndented = false,
+ DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
+ NumberHandling = JsonNumberHandling.AllowReadingFromString,
++
+ Converters =
+ {
+ new JsonGuidConverter(),
+ new JsonVersionConverter(),
+ new JsonStringEnumConverter(),
+ new JsonNullableStructConverterFactory(),
+ new JsonBoolNumberConverter(),
+ new JsonDateTimeConverter()
+ }
+ };
+
+ private static readonly JsonSerializerOptions _pascalCaseJsonSerializerOptions = new (_jsonSerializerOptions)
+ {
+ PropertyNamingPolicy = null
+ };
+
+ private static readonly JsonSerializerOptions _camelCaseJsonSerializerOptions = new (_jsonSerializerOptions)
+ {
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase
+ };
+
/// <summary>
/// Gets the default <see cref="JsonSerializerOptions" /> options.
/// </summary>