
How to Merge JSON Files: Fastest and Easiest Way (2026)
Merge multiple JSON files into one using free online tool, Python, or jq command line. Complete guide with code examples for arrays, objects, nested JSON, and deduplication.
Combine multiple JSON files into one valid result. Reorder files, control array and key conflicts, preview the output, and download it without uploading your data.
Drop two or more .json files, or open them from your device. Files are validated and processed locally.
Deep merge in action
// config_base.json
{
"app": "MyApp",
"database": {
"host": "localhost",
"port": 5432
},
"features": ["auth", "logging"]
}
// config_prod.json
{
"database": {
"host": "db.prod.com",
"ssl": true
},
"features": ["caching"],
"replicas": 3
}{
"app": "MyApp",
"database": {
"host": "db.prod.com",
"port": 5432,
"ssl": true
},
"features": ["auth", "logging", "caching"],
"replicas": 3
}Four simple steps
Drag and drop .json files or click to browse. Validated on upload.
Syntax errors and mismatched brackets detected automatically.
Pick array, conflict, number, and string handling. Objects are deep merged.
Get formatted JSON with proper indentation instantly.
Python, Node.js, jq
import json
# Load both JSON files
with open("config_base.json") as f1, open("config_prod.json") as f2:
base = json.load(f1)
overrides = json.load(f2)
# Shallow merge (overrides win)
merged = {**base, **overrides}
with open("merged.json", "w") as out:
json.dump(merged, out, indent=2)const fs = require("fs");
const _ = require("lodash");
const file1 = JSON.parse(fs.readFileSync("users_a.json"));
const file2 = JSON.parse(fs.readFileSync("users_b.json"));
// Deep merge - nested objects are combined, not replaced
const merged = _.merge({}, file1, file2);
fs.writeFileSync("merged.json", JSON.stringify(merged, null, 2));# Deep merge two JSON files with jq (one-liner)
jq -s '.[0] * .[1]' config_base.json config_prod.json > merged.json
# Concatenate two JSON arrays
jq -s '.[0] + .[1]' users_a.json users_b.json > all_users.json
# Merge multiple files at once
jq -s 'reduce .[] as $item ({}; . * $item)' *.json > merged.jsonReal-world scenarios
Combine paginated API responses or multi-endpoint data into a single JSON file for dashboards, analytics, or database imports.
Deep merge base, dev, staging, and production config files. Later files override earlier values while preserving shared defaults.
Merge translation JSON files from multiple translators or regions into one complete locale file without losing any keys.
Combine fixture files, mock API responses, and seed data into unified test datasets for your CI/CD pipeline.
Common questions
In-depth walkthrough
Array merge appends all items from both arrays into one array. Use this for datasets, logs, and lists where you want every record from both files. Example: [1, 2, 3] + [4, 5, 6] = [1, 2, 3, 4, 5, 6].
Object merge combines keys from both objects into one object. Use this for config files and settings where you want keys from both sources. Example: {"a": 1} + {"b": 2} = {"a": 1, "b": 2}.
Deep merge recursively combines nested objects instead of overwriting the whole parent key. Use this when both files have the same nested keys with different sub-values. Example: {"db": {"host": "localhost"}} + {"db": {"port": 5432}} = {"db": {"host": "localhost", "port": 5432}}.
The tool defaults to deep merge for objects and concatenation for arrays. To change array behavior, open Merge settings and pick an Array Strategy: Overwrite keeps only the later array, Merge Unique drops repeated primitive values (strings, numbers, booleans; objects are not compared), and Merge by Key combines objects that share the same value for a key such as id, with later fields winning. Objects without that key are kept as they are.
When both files have the same key with different values, the file later in the list wins by default. If you upload file1.json with {"name": "Alice"} and then file2.json with {"name": "Bob"}, the output will be {"name": "Bob"}.
Deep merge handles nested conflicts by going level by level. If both files have database.host but different values, the second file's value wins for that specific nested key while preserving other keys in the database object.
You can change how conflicting values are combined in Merge settings. With Conflict Resolution set to Merge Values, Number Handling can Sum Numbers (5 + 3 = 8) and String Handling can Concatenate ("ab" + "cd" = "abcd"). Arrays at the same key follow the Array Strategy. Rules the tool doesn't offer, such as keeping the higher value or choosing values by hand, need code; the Python example above is a starting point.
The tool validates each file as soon as you add it. A file with invalid JSON is marked in the file list with your browser's parser error, for example "Expected ',' or '}' after property value in JSON at position 214". Most current browsers also report the line and column. Invalid files are skipped when you merge, and the tool tells you how many were left out.
Common causes: trailing commas (valid in JavaScript, not in JSON), unquoted keys like {name: "Alice"} instead of {"name": "Alice"}, and single quotes instead of double quotes.
Fix the error in a text editor first, then re-upload. The tool won't attempt to auto-correct invalid JSON because that could silently corrupt your data.
Desktop and IDE picks
After merging files, open the result in a JSON editor if you need schema validation, tree navigation, large-file search, or IDE integration.
Hand-picked guides to go deeper

Merge multiple JSON files into one using free online tool, Python, or jq command line. Complete guide with code examples for arrays, objects, nested JSON, and deduplication.

Split large JSON files into smaller chunks with an online tool, Python scripts, or jq. Includes examples for big datasets and nested JSON.