|
|
@ -227,9 +227,9 @@ impl Value { |
|
|
|
Self::Boolean(b) => Ok(JSONValue::Bool(b)), |
|
|
|
Self::Boolean(b) => Ok(JSONValue::Bool(b)), |
|
|
|
Self::Object(ref obj) => obj.to_json(interpreter), |
|
|
|
Self::Object(ref obj) => obj.to_json(interpreter), |
|
|
|
Self::String(ref str) => Ok(JSONValue::String(str.to_string())), |
|
|
|
Self::String(ref str) => Ok(JSONValue::String(str.to_string())), |
|
|
|
Self::Rational(num) => Ok(JSONNumber::from_f64(num) |
|
|
|
Self::Rational(num) => Ok(JSONValue::Number( |
|
|
|
.map(JSONValue::Number) |
|
|
|
JSONNumber::from_str(&Number::to_native_string(num)).unwrap(), |
|
|
|
.unwrap_or(JSONValue::Null)), |
|
|
|
)), |
|
|
|
Self::Integer(val) => Ok(JSONValue::Number(JSONNumber::from(val))), |
|
|
|
Self::Integer(val) => Ok(JSONValue::Number(JSONNumber::from(val))), |
|
|
|
Self::BigInt(_) => { |
|
|
|
Self::BigInt(_) => { |
|
|
|
Err(interpreter.construct_type_error("BigInt value can't be serialized in JSON")) |
|
|
|
Err(interpreter.construct_type_error("BigInt value can't be serialized in JSON")) |
|
|
|