diff --git a/MediaBrowser.Common/Json/Converters/JsonBoolNumberConverter.cs b/MediaBrowser.Common/Json/Converters/JsonBoolNumberConverter.cs
index f73ca344ca..cb2047049e 100644
--- a/MediaBrowser.Common/Json/Converters/JsonBoolNumberConverter.cs
+++ b/MediaBrowser.Common/Json/Converters/JsonBoolNumberConverter.cs
@@ -8,9 +8,6 @@ namespace MediaBrowser.Common.Json.Converters
/// Converts a number to a boolean.
/// This is needed for HDHomerun.
///
- ///
- /// Adding this to the JsonConverter list causes recursion.
- ///
public class JsonBoolNumberConverter : JsonConverter
{
///
@@ -21,7 +18,7 @@ namespace MediaBrowser.Common.Json.Converters
return Convert.ToBoolean(reader.GetInt32());
}
- return JsonSerializer.Deserialize(ref reader, options);
+ return reader.GetBoolean();
}
///
diff --git a/MediaBrowser.Common/Json/JsonDefaults.cs b/MediaBrowser.Common/Json/JsonDefaults.cs
index c5050a21db..b76edd2bc7 100644
--- a/MediaBrowser.Common/Json/JsonDefaults.cs
+++ b/MediaBrowser.Common/Json/JsonDefaults.cs
@@ -43,6 +43,7 @@ namespace MediaBrowser.Common.Json
options.Converters.Add(new JsonVersionConverter());
options.Converters.Add(new JsonStringEnumConverter());
options.Converters.Add(new JsonNullableStructConverterFactory());
+ options.Converters.Add(new JsonBoolNumberConverter());
return options;
}
diff --git a/tests/Jellyfin.Common.Tests/Json/JsonBoolNumberTests.cs b/tests/Jellyfin.Common.Tests/Json/JsonBoolNumberTests.cs
index 1cae5b8491..3779e2d0ae 100644
--- a/tests/Jellyfin.Common.Tests/Json/JsonBoolNumberTests.cs
+++ b/tests/Jellyfin.Common.Tests/Json/JsonBoolNumberTests.cs
@@ -1,5 +1,5 @@
using System.Text.Json;
-using Jellyfin.Common.Tests.Models;
+using MediaBrowser.Common.Json.Converters;
using Xunit;
namespace Jellyfin.Common.Tests.Json
@@ -14,10 +14,10 @@ namespace Jellyfin.Common.Tests.Json
[InlineData("false", false)]
public static void Deserialize_Number_Valid_Success(string input, bool? output)
{
- var inputJson = $"{{ \"Value\": {input} }}";
var options = new JsonSerializerOptions();
- var value = JsonSerializer.Deserialize(inputJson, options);
- Assert.Equal(value?.Value, output);
+ options.Converters.Add(new JsonBoolNumberConverter());
+ var value = JsonSerializer.Deserialize(input, options);
+ Assert.Equal(value, output);
}
}
}
\ No newline at end of file
diff --git a/tests/Jellyfin.Common.Tests/Models/BoolTypeModel.cs b/tests/Jellyfin.Common.Tests/Models/BoolTypeModel.cs
deleted file mode 100644
index feb952efc5..0000000000
--- a/tests/Jellyfin.Common.Tests/Models/BoolTypeModel.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Text.Json.Serialization;
-using MediaBrowser.Common.Json.Converters;
-
-namespace Jellyfin.Common.Tests.Models
-{
- ///
- /// The bool type model.
- ///
- public class BoolTypeModel
- {
- ///
- /// Gets or sets a value indicating whether the value is true or false.
- ///
- [JsonConverter(typeof(JsonBoolNumberConverter))]
- public bool Value { get; set; }
- }
-}
\ No newline at end of file