Skip to content

Nullables with non-default value are serialized in duplicate #137

@bcarruthers

Description

@bcarruthers

Thank you for fixing the other nullable issue. When testing, I found another issue when serializing non-default nullable values, which is reproduced in this test:

[TestMethod]
public void NonDefaultNullableValueSerializes()
{
    var obj = new NullableTest { x = 5 };
    var settings = new NetJSONSettings { SkipDefaultValue = true };
    var json = NetJSON.Serialize(obj, settings);
    Assert.AreEqual("{\"x\":5}", json);
}

Expected:<{"x":5}>. Actual:<{"x":5"x":5}>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions