diff --git a/IEXSharp/Helper/ExecutorBase.cs b/IEXSharp/Helper/ExecutorBase.cs
index 07d5dc4..a20457d 100644
--- a/IEXSharp/Helper/ExecutorBase.cs
+++ b/IEXSharp/Helper/ExecutorBase.cs
@@ -26,16 +26,8 @@ internal static JsonSerializerOptions JsonSerializerOptions
}
else
{
- jsonSerializerOptions = new JsonSerializerOptions
- {
- IgnoreNullValues = true,
- PropertyNameCaseInsensitive = true,
- };
+ jsonSerializerOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web);
jsonSerializerOptions.Converters.Add(new DictionaryDatetimeTValueConverter());
- jsonSerializerOptions.Converters.Add(new Int32Converter());
- jsonSerializerOptions.Converters.Add(new Int64Converter());
- jsonSerializerOptions.Converters.Add(new DecimalConverter());
- jsonSerializerOptions.Converters.Add(new DecimalNullableConverter());
jsonSerializerOptions.Converters.Add(new StringConverter());
jsonSerializerOptions.Converters.Add(new DateTimeConverter());
return jsonSerializerOptions;
diff --git a/IEXSharp/Helper/JSONConverters.cs b/IEXSharp/Helper/JSONConverters.cs
index c7f8d0a..3e0bacc 100644
--- a/IEXSharp/Helper/JSONConverters.cs
+++ b/IEXSharp/Helper/JSONConverters.cs
@@ -56,41 +56,6 @@ public override void Write(Utf8JsonWriter writer, string value,
JsonSerializerOptions options) => writer.WriteStringValue(value);
}
- /// Allow both quoted and unquoted numbers on deserialize.
- public class Int32Converter : JsonConverter
- {
- public override int? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
- {
- if (reader.TokenType == JsonTokenType.String)
- {
- var stringValue = reader.GetString();
- if (int.TryParse(stringValue, out var value))
- {
- return value;
- }
- return null;
- }
- if (reader.TokenType == JsonTokenType.Number)
- {
- return reader.GetInt32();
- }
- throw new JsonException();
- }
-
- public override void Write(Utf8JsonWriter writer, int? input,
- JsonSerializerOptions options)
- {
- if (input.HasValue)
- {
- writer.WriteNumberValue(input.Value);
- }
- else
- {
- writer.WriteNullValue();
- }
- }
- }
-
public class DateTimeConverter : JsonConverter
{
public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
@@ -122,104 +87,6 @@ public override void Write(Utf8JsonWriter writer, DateTime? input,
}
}
- /// Allow both quoted and unquoted numbers on deserialize.
- public class Int64Converter : JsonConverter
- {
- public override long? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
- {
- if (reader.TokenType == JsonTokenType.String)
- {
- var stringValue = reader.GetString();
- if (long.TryParse(stringValue, out var value))
- {
- return value;
- }
- return null;
- }
- if (reader.TokenType == JsonTokenType.Number)
- {
- return reader.GetInt64();
- }
- throw new JsonException();
- }
-
- public override void Write(Utf8JsonWriter writer, long? input,
- JsonSerializerOptions options)
- {
- if (input.HasValue)
- {
- writer.WriteNumberValue(input.Value);
- }
- else
- {
- writer.WriteNullValue();
- }
- }
- }
-
- /// Allow both quoted and unquoted numbers on deserialize.
- public class DecimalConverter : JsonConverter
- {
- public override decimal Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
- {
- if (reader.TokenType == JsonTokenType.String)
- {
- var stringValue = reader.GetString();
- if (decimal.TryParse(stringValue, out var value))
- {
- return value;
- }
- throw new JsonException();
- }
- if (reader.TokenType == JsonTokenType.Number)
- {
- return reader.GetDecimal();
- }
- throw new JsonException();
- }
-
- public override void Write(Utf8JsonWriter writer, decimal input,
- JsonSerializerOptions options)
- {
- writer.WriteNumberValue(input);
- }
- }
-
- /// Allow both quoted and unquoted numbers on deserialize.
- public class DecimalNullableConverter : JsonConverter
- {
- public override decimal? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
- {
- if (reader.TokenType == JsonTokenType.String)
- {
- var stringValue = reader.GetString();
- if (decimal.TryParse(stringValue, out var value))
- {
- return value;
- }
- return null;
- }
- if (reader.TokenType == JsonTokenType.Number)
- {
- return reader.GetDecimal();
- }
- throw new JsonException();
- }
-
- public override void Write(Utf8JsonWriter writer, decimal? input,
- JsonSerializerOptions options)
- {
- if (input.HasValue)
- {
- writer.WriteNumberValue(input.Value);
- }
- else
- {
- writer.WriteNullValue();
- }
- }
- }
-
///
/// Allow dictionaries with key of type DateTime (System.Text.Json only supports keys of type string)
///
diff --git a/IEXSharp/IEXSharp.csproj b/IEXSharp/IEXSharp.csproj
index 68f3955..f022bbf 100644
--- a/IEXSharp/IEXSharp.csproj
+++ b/IEXSharp/IEXSharp.csproj
@@ -40,9 +40,9 @@
-
-
-
+
+
+
diff --git a/IEXSharpTest/Cloud/CoreData/StockPricesTest.cs b/IEXSharpTest/Cloud/CoreData/StockPricesTest.cs
index 6fbe964..3f429f5 100644
--- a/IEXSharpTest/Cloud/CoreData/StockPricesTest.cs
+++ b/IEXSharpTest/Cloud/CoreData/StockPricesTest.cs
@@ -47,6 +47,7 @@ public async Task DelayedQuoteAsyncTest(string symbol)
[TestCase("AAPL", ChartRange.Max)]
[TestCase("AAPL", ChartRange.Ytd)]
[TestCase("AAPL", ChartRange.OneMonth)]
+ [TestCase("WWR", ChartRange.TwoYears)]
public async Task HistoricalPriceAsync(string symbol,
ChartRange range = ChartRange.OneMonth, QueryStringBuilder qsb = null)
{