Home › Developer Tools › JSON Merge Tool

JSON Merge Tool

Combine two or more JSON documents into one. Choose how arrays are joined and which value wins when the same key has different values, then review every overwritten value in the conflict report before you copy or download the result.

Last updated:

Advertisement
Advertisement

How to use the JSON Merge Tool

  1. Paste the base JSON into the first box and the JSON to merge into it in the second box, or upload .json files.
  2. Add more inputs if needed. They are merged left to right, top to bottom.
  3. Choose the mode and array strategy, for example Deep merge with Union or Merge by key field id.
  4. Set the conflict rule: later input wins (typical for config overrides) or earlier input wins (defaults fill gaps only).
  5. Check the Conflicts tab, then copy the result or download merged.json.

Merge strategies compared

Example: merging {"tags":["a","b"],"db":{"host":"x","port":1}} with {"tags":["b","c"],"db":{"port":2}}, later input wins.

Settingtags becomesdb becomes
Deep merge + Concatenate["a","b","b","c"]{"host":"x","port":2}
Deep merge + Union["a","b","c"]{"host":"x","port":2}
Deep merge + Replace["b","c"]{"host":"x","port":2}
Deep merge + Merge by index["b","c"] (item by item){"host":"x","port":2}
Shallow merge["b","c"]{"port":2} (host is lost)
JSON Merge Patch (RFC 7396)["b","c"]{"host":"x","port":2}

Typical uses

  • Layered configuration: merge config.default.json, then config.production.json, then local overrides, with later input wins.
  • Combining API pages: union or concatenate the arrays returned by paginated endpoints into one dataset.
  • Syncing records: use Merge by key field id to update existing records and append new ones without duplicates.
  • Translation files: merge a base en.json first and a partial locale file second (later input wins), so translated strings replace the English ones and anything missing falls back to English.
  • Preparing a PATCH request: preview what an application/merge-patch+json body will do to a resource before sending it.

Rules worth knowing

  • Key order is preserved: keys from earlier inputs come first, new keys are appended in the order they appear.
  • Union and duplicate detection compare whole values, and object key order does not matter ({"a":1,"b":2} equals {"b":2,"a":1}).
  • Numbers are parsed as JavaScript numbers, so integers above 253 (about 9 quadrillion) may lose precision. Store very large IDs as strings.
  • Empty input boxes are skipped, so you can keep spare inputs open without affecting the result.

Frequently asked questions

What does deep merge mean for JSON?

A deep merge combines objects key by key at every level. If both inputs have an object under the same key, those objects are merged too, instead of the later one replacing the earlier one. Only when two values that are not both objects (for example two different strings) collide does the conflict rule decide which one is kept.

How are arrays merged?

It depends on the strategy. Concatenate appends the later array after the earlier one. Union does the same but skips items that are exactly equal to one already present. Replace treats the array as one value, so the conflict rule picks a whole array. Merge by index merges item 0 with item 0 and so on. Merge by key matches objects by a field such as id and merges matching objects, appending the rest.

What is JSON Merge Patch (RFC 7396)?

RFC 7396 defines a simple patch format: the patch looks like the target document, objects are merged recursively, any key set to null is removed from the target, and every other value, including arrays, replaces the old one. It is used by HTTP PATCH APIs with the content type application/merge-patch+json and by Kubernetes.

Which value wins when keys conflict?

By default the later input wins, which is how most configuration layers work: base settings first, then environment or user overrides. Choose Earlier input wins if the first document is authoritative and later ones should only fill in missing keys. Every decision is listed in the Conflicts tab.

Can I merge JSON arrays at the top level?

Yes. If every input is an array, the array strategy is applied at the top level, so you can concatenate lists, build a union, or merge records that share an id. Mixing an object and an array at the top level is a type conflict and the conflict rule picks one of them.

Is this the same as lodash merge or Object.assign?

Object.assign and the spread operator are shallow merges, like the Shallow mode here. Lodash merge is a deep merge that merges arrays by index, which matches Deep merge with Merge by index. Note that lodash skips undefined values but not null, which matches leaving the null option unchecked.

Are my files uploaded?

No. Parsing and merging happen in JavaScript inside your browser, so the JSON never leaves your device and the tool also works offline once the page has loaded.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

JSON CompareCompare two JSON documents and see every added, removed and changed path.JSON FormatterBeautify, minify and validate JSON, with a collapsible tree view.JSON EditorEdit JSON in a tree and as code side by side: add, rename, drag, change types, undo and download.CSV MergerCombine many CSV files into one, matching columns by name, with dedupe and a source column.JSON to Excel ConverterTurn JSON into a styled .xlsx spreadsheet; nested arrays become their own linked sheets.JSON to CSVConvert JSON data to CSV for spreadsheets.CSV to JSONConvert CSV data to JSON with live preview.Excel to CSVConvert XLSX spreadsheets to CSV.CSV ViewerOpen a CSV or TSV file as a sortable, filterable table.Excel Viewer (XLSX / XLS)Open XLSX, XLS and ODS spreadsheets in your browser without Excel.Line Ending ConverterConvert text and files between CRLF, LF and CR line endings.Markdown to HTMLConvert Markdown to clean HTML with a live editor.XML to JSONConvert XML to JSON with validation.Text Encoding ConverterDetect and convert text file encodings like UTF-8, UTF-16 and Latin-1.JSON ViewerExplore JSON as a collapsible tree, search keys and values and copy any node's path.TTF to WOFF2 ConverterConvert TTF and OTF fonts to WOFF2 or WOFF and get a ready @font-face CSS snippet.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Morse Code TranslatorTranslate text to Morse code and back, then play it as sound or a blinking light, or save a WAV.HTML Table GeneratorBuild HTML tables in an editable grid with styles, header rows, CSV import and live preview.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.JSON to XML ConverterConvert JSON to well-formed XML with attributes, arrays and pretty print.JSON to YAML ConverterConvert JSON to clean YAML as you type, with indent, quoting and sort options.YAML to JSON ConverterConvert YAML to pretty or minified JSON, with errors pinned to the exact line.HTML to Markdown ConverterTurn HTML or pasted rich text into clean Markdown with tables and live preview.Markdown Table GeneratorBuild Markdown tables in a grid or paste from Excel/CSV, with alignment and preview.JSON ValidatorCheck JSON with the exact line and column of each error, fix tips and one-click auto-fix.Image to Base64Convert images to Base64 data URIs, CSS backgrounds and HTML img tags in your browser.Base64 to ImagePaste a Base64 string or data URI to preview, identify and download the image.Hex to DecimalConvert hex to decimal instantly with steps and signed mode.Decimal to HexConvert decimal to hex instantly with steps and signed mode.Binary to DecimalConvert binary to decimal instantly with steps and signed mode.Decimal to BinaryConvert decimal to binary instantly with steps and signed mode.Two's Complement CalculatorDecimal to two's complement binary and back for 4-64 bits, with invert-and-add-1 steps.XML to CSV ConverterConvert XML to CSV: detects repeating records, flattens nested data, pick your columns.CSV to XML ConverterConvert CSV to well-formed XML with custom root and row names, escaping and pretty print.TOML to JSON ConverterConvert TOML to JSON and JSON to TOML with a full v1.0 parser and clear error lines.JSON to Go StructTurn JSON into Go structs with inferred types, nested structs and json tags.XML to YAML ConverterConvert XML to clean YAML with attributes, text nodes, lists and exact error lines.YAML to XML ConverterConvert YAML to pretty, well-formed XML with custom root, attributes and array item tags.Boolean Algebra SimplifierSimplify boolean expressions or minterm lists to minimal SOP and POS with Quine-McCluskey steps.Compare Excel FilesCompare two Excel spreadsheets cell by cell, highlight changes and export a diff report.CSV CleanerClean messy CSV in one click: trim spaces, drop empty rows and columns, fix headers, dedupe.CSV VLOOKUP ToolJoin two CSV or Excel files on a key column like VLOOKUP, with left, inner and full joins.Remove Duplicates in ExcelFind and remove or highlight duplicate rows in XLSX or CSV files by the columns you choose.GeoJSON ViewerView GeoJSON on a map, inspect and edit properties, validate against RFC 7946 and export.GPX ViewerOpen GPX tracks on a map with distance, elevation profile, moving time, speed and splits.JSON Repair ToolFix broken JSON automatically: trailing commas, quotes, comments, truncated data, with a diff.Karnaugh Map SolverSolve 2–6 variable K-maps: click cells or enter minterms to get the minimal SOP or POS with groups.Merge Excel FilesCombine XLSX, XLS and CSV files into one workbook or append all rows into a single sheet.Parquet File ViewerOpen Apache Parquet files in your browser: schema, rows, filters and CSV or JSON export.Query CSV with SQLRun SQL on CSV, Excel, JSON and Parquet files in your browser with DuckDB. Join and export.Online Serial MonitorTalk to Arduino, ESP32 and USB serial devices in your browser: log, send, plot and save.Split Excel FileSplit an Excel sheet into several files by row count or by each value in a column, as ZIP.SQL Create Table GeneratorDefine columns, keys, defaults and indexes; get CREATE TABLE SQL for MySQL, Postgres and more.SQL IN Clause GeneratorTurn a pasted list into a SQL IN ('a','b') clause with quoting, dedupe and 1,000-item chunks.SQL Online CompilerRun SQL queries online on SQLite with sample databases, a result grid, CSV export and .db save.SQL to ER DiagramPaste CREATE TABLE statements and get an entity-relationship diagram with keys and links.XML to XSD GeneratorGenerate an XML Schema (XSD) from sample XML: types, occurrences, attributes and namespaces.XML ValidatorCheck if XML is well-formed, see the exact line and column of each error and pretty-print it.Wildcard Mask CalculatorConvert a subnet mask or CIDR to a wildcard mask for ACLs and OSPF, with range and binary.CSV to VCF ConverterConvert a contacts CSV into a vCard (.vcf) file, mapping columns to name, phone, email and more.CSV to YAML ConverterConvert CSV rows to a YAML list of mappings with type inference and delimiter detection.Endianness ConverterSwap byte order of 16, 32 and 64-bit hex values and see big- and little-endian integers and floats.Excel to SQL ConverterTurn an Excel sheet into CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server.Excel to VCF ConverterTurn an Excel contact list into a vCard .vcf file for iPhone, Android, Google or Outlook.File to C ArrayConvert any file into a C or C++ byte array header, like xxd -i, with const and PROGMEM options.Image to C ArrayConvert images to monochrome, RGB565 or RGB888 C arrays for OLED, LCD and TFT displays.
See all 129 Data & File Format Converters →