Closed willianwrm closed 2 years ago
hi line 99 add new case
case "nan": return double.NaN;
LiteDB/Document/Json/JsonReader.cs
Hi @willianwrm, bug fixed. As javascript JSON.stringify() converts NaN to 'null', we just fixed it the same way. So it wouldn't throw the exception anymore and NaN and Infinity values will be serialized to JSON as null.
Version 5.0.11 for .NET Framework 4.5 with C# (NuGet)
Describe the bug Method JsonSerializer.Deserialize throws exceptions while reading NaN or Infinity double values.
Code to Reproduce
Screenshots/Stacktrace
JSON value from JsonSerializer.Serialize
{"Test":NaN}
Other I did try replacing it to "NaN" (with quotation marks) but then the value is not a double anymore but a string; property BsonValue.AsDouble fails.