diff --git a/StabilityMatrix.Core/Converters/Json/ParsableStringValueJsonConverter.cs b/StabilityMatrix.Core/Converters/Json/ParsableStringValueJsonConverter.cs index ac1ab51e..a8d438b3 100644 --- a/StabilityMatrix.Core/Converters/Json/ParsableStringValueJsonConverter.cs +++ b/StabilityMatrix.Core/Converters/Json/ParsableStringValueJsonConverter.cs @@ -42,9 +42,9 @@ public class ParsableStringValueJsonConverter< JsonSerializerOptions options ) { - if (reader.TokenType != JsonTokenType.String) + if (reader.TokenType != JsonTokenType.PropertyName) { - throw new JsonException(); + throw new JsonException("Unexpected token type"); } var value = reader.GetString(); @@ -87,11 +87,11 @@ public class ParsableStringValueJsonConverter< if (value is IFormattable formattable) { - writer.WriteStringValue(formattable.ToString(null, CultureInfo.InvariantCulture)); + writer.WritePropertyName(formattable.ToString(null, CultureInfo.InvariantCulture)); } else { - writer.WriteStringValue(value.ToString()); + writer.WritePropertyName(value.ToString()); } } }