Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Boolean syntax is not fully supported #329

Closed
Pistonight opened this issue Sep 14, 2022 · 0 comments · Fixed by #330
Closed

Boolean syntax is not fully supported #329

Pistonight opened this issue Sep 14, 2022 · 0 comments · Fixed by #330

Comments

@Pistonight
Copy link

From https://yaml.org/type/bool.html True should be treated as a boolean

let source = "key1: true\nkey2: True";
let obj = serde_yaml::from_str::<serde_json::Value>(source).unwrap();
assert_eq!(obj["key1"].as_bool(), Some(true)); // pass
assert_eq!(obj["key2"].as_str(), Some("True")); // pass - should fail
assert_eq!(obj["key2"].as_bool(), Some(true)); // fail - should pass

serde_yaml version 0.9.12

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

Successfully merging a pull request may close this issue.

1 participant