Open
Description
Both 9e-05
and 9e-5
mean the same thing in scientific notation, as leading zeros in the exponent are optional.
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"] }
Metadata
Metadata
Assignees
Labels
No labels