We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Feel free to ask any question on how to use the library. Alternatively, consider asking the question on Stackoverflow, tagged with yamldotnet.
Is there any scheme to automatically skip the property of the exception when deserializing?
Such as:
config.yaml:
config.yaml
first: something1 second: something2 third: something3
Config.cs:
Config.cs
public class Config { public string first { get; set; } public string second { get; set; } }
Because third is not in the class, deserialization will fail and an exception will be thrown.
third
How can it skip the third property automatically and continute the deserialization whitout exception.
The purpose is to construct Config class entities as much as possible.
I know YamlDotNet.Dynamic or RepresentationModel can do it, but it's manual, not automatic.
YamlDotNet.Dynamic
RepresentationModel
The text was updated successfully, but these errors were encountered:
On the DeserializerBuilder call IgnoreUnmatchedProperties. That worked when I just tested it.
DeserializerBuilder
IgnoreUnmatchedProperties
var deserializer = new DeserializerBuilder().IgnoreUnmatchedProperties().Build(); var yaml = @" first: something1 second: something2 third: something3 "; var config = deserializer.Deserialize<Config>(yaml); class Config { public string first { get; set; } public string second { get; set; } }
Sorry, something went wrong.
Re open if you need further help.
No branches or pull requests
Feel free to ask any question on how to use the library. Alternatively, consider asking the question on Stackoverflow, tagged with yamldotnet.
Is there any scheme to automatically skip the property of the exception when deserializing?
Such as:
config.yaml
:Config.cs
:Because
third
is not in the class, deserialization will fail and an exception will be thrown.How can it skip the
third
property automatically and continute the deserialization whitout exception.The purpose is to construct Config class entities as much as possible.
I know
YamlDotNet.Dynamic
orRepresentationModel
can do it, but it's manual, not automatic.The text was updated successfully, but these errors were encountered: