fix JsonValue

This commit is contained in:
eugeniy_ivanov 2023-04-17 18:13:36 +05:00
parent 1202bf024e
commit 33ebaf39c1

View File

@ -30,37 +30,37 @@ namespace AsbCloudWebApi.Converters
public override void Write(Utf8JsonWriter writer, JsonValue value, JsonSerializerOptions options)
{
if (value.Value is string strValue)
if (value.value is string strValue)
{
writer.WriteStringValue(FormatString(strValue));
return;
}
if (value.Value is int intValue)
if (value.value is int intValue)
{
writer.WriteNumberValue(intValue);
return;
}
if (value.Value is short shortValue)
if (value.value is short shortValue)
{
writer.WriteNumberValue(shortValue);
return;
}
if (value.Value is float floatValue)
if (value.value is float floatValue)
{
writer.WriteRawValue(floatValue.ToString("#0.0##", CultureInfo.InvariantCulture), true);
return;
}
if (value.Value is double doubleValue)
if (value.value is double doubleValue)
{
writer.WriteRawValue(doubleValue.ToString("#0.0##", CultureInfo.InvariantCulture), true);
return;
}
var typeName = value.Value.GetType().Name;
var typeName = value.value.GetType().Name;
throw new NotImplementedException($"{typeName} is not supported type for WITS value");
}