JsonConfig
JsonConfig copied to clipboard
Merging with null as default
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