JSON Merger

    Combine multiple JSON objects into one

    Strategy:

    Multiple Strategies

    Deep merge, shallow merge, or array concat

    100% Private

    All processing happens in your browser

    No Signup

    Free tool, no registration required

    JSON Merging: Strategies for Combining Objects

    Merging JSON objects means combining two or more objects into a single result. This sounds simple, but there are several distinct strategies, and the right one depends on whether you want to preserve or overwrite conflicting keys, and whether nested objects should be deeply merged or shallowly replaced. Choosing the wrong strategy leads to data loss or unexpected results.

    Shallow vs Deep Merge

    A shallow merge (like JavaScript's Object.assign(, a, b) or the spread operator {...a, ...b}) copies all top-level keys from each source into the target. If both objects have a nested key like config, the second object's config completely replaces the first — the nested properties of the first are lost. A deep merge recursively merges nested objects, preserving keys from both sides. Deep merge is what you usually want when combining configuration objects or partial updates.

    Array Merge Strategies

    Arrays add another layer of complexity. Should merging two arrays concatenate them? Keep only unique values? Replace the first with the second? There's no single right answer — it depends on whether the array represents an ordered list (concatenate), a set (union), or a scalar value to be overwritten (replace). This is why many deep merge libraries expose array merge strategy options separately from object merge behavior.

    How to Use This Tool

    Paste two or more JSON objects and choose your merge strategy. For configuration merging, deep merge with the second object taking precedence on conflicts is the most common choice — it lets you start with defaults and override specific keys. The merged result appears in the output area ready to copy.

    Frequently Asked Questions