How to deserialize “NaN” as `nan` with serde_json?
I have datatypes which look like this: #[derive(Serialize, Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub struct Matrix { #[serde(rename = "numColumns")] pub num_cols: usize, #[serde(rename = "numRows")] pub num_rows: usize, pub data: Vec<f64>, } My JSON bodies look something like this: { "numRows": 2, "numColumns": 1, "data": [1.0, "NaN"] } This is the serialization provided by Jackson (from a Java server we use), and is valid JSON. Unfortunately if we call serde_json::from_str(&blob) we get an error: Error("invalid type: string "NaN", expected f64", [snip] I understand there are