From 0719a7bfdd005dcc4491ea33ff21d88f733d22a7 Mon Sep 17 00:00:00 2001 From: Refringe Date: Thu, 31 Oct 2024 22:42:26 -0400 Subject: [PATCH] Resolves ArgumentException when processing 0.15.5 loot Resolves the following exception: System.ArgumentException: .NET number values such as positive and negative infinity cannot be written as valid JSON. To make it work when using 'JsonSerializer', consider specifying 'JsonNumberHandling.AllowNamedFloatingPointLiterals' --- Serializers/Json/NetJsonSerializer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Serializers/Json/NetJsonSerializer.cs b/Serializers/Json/NetJsonSerializer.cs index a2c748b..d4c9526 100644 --- a/Serializers/Json/NetJsonSerializer.cs +++ b/Serializers/Json/NetJsonSerializer.cs @@ -9,6 +9,7 @@ public class NetJsonSerializer : IJsonSerializer private static JsonSerializerOptions _serializeOptions = new() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals, Converters = { new NetJsonKeyConverter(), @@ -26,4 +27,4 @@ public class NetJsonSerializer : IJsonSerializer { return JsonSerializer.Deserialize(obj, _serializeOptions); } -} \ No newline at end of file +}