xoofx / SharpYaml

SharpYaml is a .NET library for YAML compatible with CoreCLR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The string "null" should be deserialized as a string, not as null

mstefarov opened this issue · comments

I have a piece of YAML that contains the string literal "null". Other YAML parsers (e.g. YamlDotNet) treat this as a string "null", but SharpYaml interprets it as just null.

Example:

values:
  - name: "null"
    value: 5
    summary: No fill.
public class YEnum
{
    public List<YEnumValue> Values { get; set; } = new();
}
public class YEnumValue
{
    public string Name { get; set; }
    public int Value { get; set; }
    public string Summary { get; set; }
}

Expected deserialization result: myEnum.Values[0].Name == "null"
Actual deserialization result: myEnum.Values[0].Name == null