JSON Array Merger (by key)

Merge two JSON arrays of objects on a join key with inner / left / right / outer joins.

About JSON Array Merger (by key)

JSON Array Merger merges two arrays of objects on a join key, the same way SQL joins two tables. Pick the join type — inner (records present in both), left (every A record, with B fields where they match), right (every B record, with A fields where they match), or outer (every record from either side) — and the tool aligns objects whose join-key value matches. Fields from both sides are merged into the output objects, with B winning on conflicts by default.

This is the array-of-objects counterpart of JSON Deep Merge. Deep Merge layers two objects on top of each other; Array Merger joins two arrays row-by-row. Reach for it whenever you have two record sets that share an identifier (user ID, email, SKU) and you want a single combined view: enrich a user list with profile data, attach pricing to a product list, augment log lines with metadata. Records that do not match the chosen join type are dropped or kept based on the join.

Examples

Input
List A: [{"id":1,"name":"Ada"},{"id":2,"name":"Bob"}]
List B: [{"id":1,"role":"admin"},{"id":3,"role":"guest"}]
Join key: id
Output
[{"id":1,"name":"Ada","role":"admin"}]

Inner join — only records present in both arrays. Switch to outer to also keep id=2 (no role) and id=3 (no name).

Frequently asked questions

How is this different from JSON Deep Merge?

Deep Merge merges two objects (e.g., a default config plus an override). Array Merger merges two arrays of objects on a join key (e.g., users plus profiles). Different shapes, different jobs — pick by what your two inputs are.

What does 'B wins on conflicts' mean?

When both A and B have a record with the same join-key value and they share other fields whose values differ, the version from B is kept. Switch to 'A wins' if A is the canonical side. The join key itself is never overwritten.

Can I join on more than one key?

Not directly. Concatenate the join fields into a single composite key in each input first (e.g., create `${tenant}:${user_id}`), then run the merger on that composite.

What happens when a join-key value appears multiple times in one input?

Each occurrence is treated as a separate record. The merger does an N×M cross-match within that key, the same way SQL handles duplicate join-key values.