1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibJS: Fix that non-double numbers from JSON were truncated to i32

This commit is contained in:
davidot 2022-10-12 02:11:23 +02:00 committed by Linus Groh
parent c9aa664eb0
commit 9921f80817
2 changed files with 26 additions and 3 deletions

View file

@ -416,10 +416,10 @@ Value JSONObject::parse_json_value(VM& vm, JsonValue const& value)
return Value(parse_json_array(vm, value.as_array()));
if (value.is_null())
return js_null();
if (value.is_double())
return Value(value.as_double());
if (value.is_i32())
return Value(value.as_i32());
if (value.is_number())
return Value(value.to_i32(0));
return Value(value.to_double(0));
if (value.is_string())
return js_string(vm, value.to_string());
if (value.is_bool())