Skip to content

Merging with null as default #31

@AKnopf

Description

@AKnopf

Hey everyone,

I just ran into the problem, that you cannot merge the default value null with anothe value. They key simply will not show up in the result. Here is a quick example in Pseudocode:

var actual = @"{"override":"1png","onlyActual":1}"
var default = @"{"override":null,"onlyDefault":2}"
JsonConfig.Merger.Merge(JsonConfig.Config.ParseJson(actual),JsonConfig.Config.ParseJson(default));
// => "{"onlyActual":1,"onlyDefault:2}"

A quick research in the code lead to line 67 in Merger.cs:

                // skip already copied over keys
                if (!dict2.Keys.Contains(kvp1.Key) || dict2[kvp1.Key] == null)
                    continue;

Could this be the problem?

Cheers! Marvin

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