JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.71k stars 3.24k forks source link

JsonMergeSettings is missing MergeDictionaryHandling similar to MergeArrayHandling #2892

Open gdoron opened 1 year ago

gdoron commented 1 year ago

I could not find a built-in way with json.NET to not merge dictionaries when using JObject.Merge similar to MergeArrayHandling.Replace, it would always merge the keys.

jobject.Merge(newJobject, new JsonMergeSettings {
            MergeArrayHandling = MergeArrayHandling.Replace,
            MergeNullValueHandling = MergeNullValueHandling.Merge
           MergeDictionaryHandling = MergeDictionaryHandling.Replace // <<<--- this API seems to be missing
        });

Am I missing something obvious or does it not exist today?