mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-22 13:52:54 +00:00
Fixed issue with serialization of nullable types in System.Text.Json ArrayConverter
This commit is contained in:
@@ -87,11 +87,11 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
|
|||||||
|
|
||||||
if (prop.JsonConverterType == null && IsSimple(prop.PropertyInfo.PropertyType))
|
if (prop.JsonConverterType == null && IsSimple(prop.PropertyInfo.PropertyType))
|
||||||
{
|
{
|
||||||
if (prop.PropertyInfo.PropertyType == typeof(string))
|
if (prop.TargetType == typeof(string))
|
||||||
writer.WriteStringValue(Convert.ToString(objValue, CultureInfo.InvariantCulture));
|
writer.WriteStringValue(Convert.ToString(objValue, CultureInfo.InvariantCulture));
|
||||||
else if(prop.PropertyInfo.PropertyType.IsEnum)
|
else if(prop.TargetType.IsEnum)
|
||||||
writer.WriteStringValue(EnumConverter.GetString(objValue));
|
writer.WriteStringValue(EnumConverter.GetString(objValue));
|
||||||
else if (prop.PropertyInfo.PropertyType == typeof(bool))
|
else if (prop.TargetType == typeof(bool))
|
||||||
writer.WriteBooleanValue((bool)objValue);
|
writer.WriteBooleanValue((bool)objValue);
|
||||||
else
|
else
|
||||||
writer.WriteRawValue(Convert.ToString(objValue, CultureInfo.InvariantCulture)!);
|
writer.WriteRawValue(Convert.ToString(objValue, CultureInfo.InvariantCulture)!);
|
||||||
|
|||||||
Reference in New Issue
Block a user