serde-yaml
serde-yaml copied to clipboard
help parsing YAML with keys as with hyphens
Greetings,
I have YAML files such as:
foo-bar: baz
I'd like to use serde-yaml to parse into:
struct FooBar {
foo_bar: String,
}
Do you know if there is some simple/elegant way to deserialize this mismatch between hyphens and underscores?
Thanks for the help!
-m
struct FooBar {
#[serde(rename="foo-bar")]
foo_bar: String,
}
should work