You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
It should take over the JsonValue number into the JsValue for all primitive types,
it works already correct for string based json values like JsonValue.Parse("15")
Additional context
Problem seems to be situated here:
caseJsonValueKind.Number:
result = jsonValue.TryGetValue<double>(outvar doubleValue)? JsNumber.Create(doubleValue): JsValue.Undefined;break;
.TryGetValue<double>() returns false if the JsonValuePrimitive<T>'s T isn't a double.
Suggested fix
case JsonValueKind.Number:
var doubleValue= JsonSerializer.Deserialize<double>(jsonValue);result= JsNumber.Create(doubleValue);break;
The text was updated successfully, but these errors were encountered:
Version used
3.1.0
Describe the bug
JsonNodes get converted to JsValues, but if a JsonValue originates from a .NET integer, the conversion results in undefined
To Reproduce
roslynpad:
Expected behavior
It should take over the JsonValue number into the JsValue for all primitive types,
it works already correct for string based json values like
JsonValue.Parse("15")
Additional context
Problem seems to be situated here:
.TryGetValue<double>()
returns false if theJsonValuePrimitive<T>
's T isn't adouble
.Suggested fix
The text was updated successfully, but these errors were encountered: