Add decimal check in PolymorphicObjectConverter
In the PolymorphicObjectConverter class, the check for primitive types and specific object types was updated to include decimal. Fixes #4714
This commit is contained in:
parent
91ac5e816a
commit
70530aa9fe
|
|
@ -158,7 +158,7 @@ public class PolymorphicObjectConverter : JsonConverter<object>
|
|||
var newOptions = new JsonSerializerOptions(options);
|
||||
var type = value.GetType();
|
||||
|
||||
if (type.IsPrimitive || value is string or DateTimeOffset or DateTime or DateOnly or TimeOnly or JsonElement or Guid or TimeSpan or Uri or Version or Enum)
|
||||
if (type.IsPrimitive || value is string or decimal or DateTimeOffset or DateTime or DateOnly or TimeOnly or JsonElement or Guid or TimeSpan or Uri or Version or Enum)
|
||||
{
|
||||
// Remove the converter so that we don't end up in an infinite loop.
|
||||
newOptions.Converters.RemoveWhere(x => x is PolymorphicObjectConverterFactory);
|
||||
|
|
|
|||
Loading…
Reference in a new issue