-Fixed JToken.Load not reading past comment when CommentHandling is Ignore

-Fix JsonReader.ReadAsDecimal with JValue and BigInteger value
This commit is contained in:
James Newton-King
2017-05-13 19:14:16 +12:00
parent 515fee0b52
commit 1535268ab8
6 changed files with 193 additions and 7 deletions
+13 -1
View File
@@ -751,7 +751,19 @@ namespace Newtonsoft.Json
case JsonToken.Float:
if (!(Value is decimal))
{
SetToken(JsonToken.Float, Convert.ToDecimal(Value, CultureInfo.InvariantCulture), false);
decimal d;
#if HAVE_BIG_INTEGER
if (Value is BigInteger)
{
d = (decimal)(BigInteger)Value;
}
else
#endif
{
d = Convert.ToDecimal(Value, CultureInfo.InvariantCulture);
}
SetToken(JsonToken.Float, d, false);
}
return (decimal)Value;