We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Both 9e-05 and 9e-5 mean the same thing in scientific notation, as leading zeros in the exponent are optional.
9e-05
9e-5
use serde_json::{from_str, json, to_string, Value}; fn main() { let json_str = r#"{"a":9e-05}"#; let json_val: Value = from_str(json_str).unwrap(); // println!("{}", to_string(&json_val).unwrap()); println!("{}", json_val.to_string()); assert_eq!( to_string(&json_val).unwrap(), json_str ); }
{"a":0.00009} thread 'main' panicked at src/main.rs:17:5: assertion `left == right` failed left: "{\"a\":0.00009}" right: "{\"a\":9e-05}"
[package] name = "serde_float" version = "0.1.0" edition = "2021" [dependencies] serde_json = {version = "1.0", features = ["preserve_order"] }
The text was updated successfully, but these errors were encountered:
How can I specify a floating point number to output in scientific notation? "{"a":9e-05}" in, and "{"a":9e-05}" out
"{"a":9e-05}"
Sorry, something went wrong.
No branches or pull requests
Both
9e-05
and9e-5
mean the same thing in scientific notation, as leading zeros in the exponent are optional.The text was updated successfully, but these errors were encountered: