Visual RFC.
ALL RFCs / RFC 7396
Read the RFC ↗
RFC 7396 / JSON MERGE PATCH

Check the patch type first

04

The type of the patch decides whether to merge object members or replace the whole target.

RFC 7396 · § 2EXAMPLE
3 / 3
Check the patch type firstThree independent examples compare patch types: root null replaces an object, a string replaces an array, and an empty object patch converts an array target to an empty object.The patch type selects the branchThree independent examples, not consecutive requestsTarget[1,2]Patch{}object patchstart from {}Result{}{} over an array is not a no-op
03
Start an object merge from an empty object.

An object patch over a non-object target first discards that target. With no members to process, {} produces {}.

Source for this drawing: RFC 7396 · Read RFC section 2 ↗

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

A message needs an address.

Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.

Helpful first, if these ideas are unfamiliar

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Terms in this drawing
Root patch
The entire patch value, as distinct from a member value inside it.
No-op
An operation that makes no change; {} is only a no-op for object targets.
Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

KEY POINT

An object patch and a non-object patch take different branches.

  • The target may be any JSON value or may be undefined; the patch may be any JSON value. If the patch is not an object, the result is the entire patch, including a root null value.
  • If the patch is an object but the target is not an object, start from an empty object and process the patch members. The previous scalar or array content is discarded.
  • An empty object patch leaves an existing object unchanged, but it replaces a non-object target with an empty object. Therefore {} is not a universal no-op patch.
DETAILS

The drawing compares three independent examples, not three changes sent in sequence: a root null patch replaces an object with null; a string patch replaces an array with that string; an empty object patch converts an array target into {}. Root null is not the same operation as a null-valued member inside an object patch.

Read the RFC section ↗

All chapters in RFC 7396

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗