Skip to content
New issue

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

String keys with 0s at the front can not be converted to numbers #1077

Open
theCapypara opened this issue Oct 9, 2023 · 0 comments
Open

Comments

@theCapypara
Copy link

serde_json version 1.0.101 broke the following:

use std::collections::HashMap;
use serde_json; // 1.0.105

fn main() {
    let data = r#"
        {
            "01234": "foo"
        }"#;

    let _: HashMap<i64, String> = serde_json::from_str(data).unwrap();
    
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021

Before this release serde_json "correctly" (I guess that is up to debate) stripped the numbers in front and converted the key in this case to 1234i64. Now it just fails to parse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant