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

serde_json::from_slice serialize empty array error #903

Closed
baoyachi opened this issue Jul 4, 2022 · 1 comment
Closed

serde_json::from_slice serialize empty array error #903

baoyachi opened this issue Jul 4, 2022 · 1 comment

Comments

@baoyachi
Copy link

baoyachi commented Jul 4, 2022

fn main() {
    let buf = vec![];
    let x:serde_json::Value = serde_json::from_slice(&buf).unwrap();
    println!("{:?}",x);
}

expected value:Null, But now, the code serialize error

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("EOF while parsing a value", line: 1, column: 0)', src/main.rs:3:60

playground: link

@dtolnay
Copy link
Member

dtolnay commented Jul 4, 2022

This is behaving correctly, since is not valid JSON.

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

2 participants