How to merge JSON files online
- Paste your JSON into Input 1 and Input 2, or load .json files from your device.
- Choose deep or shallow merge, an array strategy and which input wins when keys conflict.
- Copy the merged result and check the conflict report to see exactly which values were overridden.
Deep merge vs shallow merge
A shallow merge replaces entire top-level values: if both files contain a config object, one replaces the other. A deep merge walks through nested objects and combines them, so keys that exist in only one file are preserved. Deep merge is what you want for configuration files, translations and API payloads.
Array merge strategies
- Concatenate: append the arrays one after the other.
- Concatenate (unique): append and remove duplicate items.
- Replace: keep the array from the winning input.
- Merge by index: merge items at the same position.
Example
Merging these two documents with deep merge and “Concatenate” arrays:
A: {"name":"app","config":{"debug":false,"port":3000},"tags":["api"]}
B: {"config":{"debug":true,"host":"localhost"},"tags":["node"]}
Result: {"name":"app","config":{"debug":true,"port":3000,"host":"localhost"},"tags":["api","node"]}
Common use cases
- Combining
package.jsonortsconfig.jsonfragments. - Merging i18n translation files.
- Layering environment-specific configuration over a base config.
- Joining API responses or OpenAPI/Swagger specification parts.
Frequently asked questions
Is it safe to merge JSON that contains sensitive data?
Yes. MergeJson runs entirely in your browser. Your JSON is never uploaded, sent to a server or stored.
What is the difference between deep merge and shallow merge?
A shallow merge replaces whole top-level values, while a deep merge combines nested objects recursively so keys that exist only in one file are preserved.
Can I merge more than two JSON files?
Yes. Add as many inputs as you need. Input 1 is merged with input 2, then the result with input 3, and so on.
What happens when the same key exists in several files?
By default the last input wins, but you can choose that the first input wins. A conflict report lists every overridden value.
How are arrays merged?
You can concatenate arrays, concatenate them without duplicates, replace them, or merge them by index.