Skip to content

Merging with null as default #31

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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