Skip to content
New issue

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

Merging with null as default #31

Open
AKnopf opened this issue Jul 28, 2016 · 0 comments
Open

Merging with null as default #31

AKnopf opened this issue Jul 28, 2016 · 0 comments

Comments

@AKnopf
Copy link

AKnopf commented Jul 28, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant