json
json copied to clipboard
Update to "1.0.85" changes behaviour
In a recent (dependabot) update from 1.0.83 to 1.0.85 I am seeing a change in behaviour where values produced using json!() shift from being integers to being floats.
The output is the result of a division:
let dividend = inputs[0].as_f64().ok_or("Could not get dividend")?;
let divisor = inputs[1].as_f64().ok_or("Could not get divisor")?;
json!(dividend / divisor)
Output that before was "6" is now "6.0"? So, maybe before it was "snapping" to an integer and now it always prints as a float?
- Is that change expected?
It's quite possible this is now the "correct" behaviour, and I can easily change tests to work with it....but
- Wouldn't such a change merit a minor semver version number bump (not just patch/micro)
I would do a rust playground code snippet to show the change...but don't think I can control versions used there?
Is that change expected?
Yes: https://github.com/serde-rs/json/pull/919
That has broken some unit tests of mine as well as some different output :/ Not a huge deal but it was probably worth a 1.1 since many people did use the Display impl to output text.