Merge object members
01An object patch visits the members it names, recursively updating nested objects while leaving unmentioned members alone.
The result keeps Ada and active, uses green, and includes newsletter: true.
Source for this drawing: RFC 7396 · Read RFC section 2 ↗
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
- Target
- The JSON value to which the patch is applied.
- Recursive merge
- Apply the same rules again inside a named member.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
Apply the object patch by member name, recursively.
- When the patch is an object, process its name/value pairs. A non-null value is merged recursively with the corresponding target member; a member not already present can be added.
- An object patch leaves unmentioned target members unchanged. Nested object patches also leave unmentioned nested members unchanged; this is not a wholesale replacement of every object encountered.
- The operation works on JSON data values, not text edits. Whitespace, member order and numeric precision beyond the implementation’s abilities are not preserved by this specification. Results on objects with duplicate member names are undefined.
Example target: {"profile":{"name":"Ada","color":"blue"},"active":true}. Patch: {"profile":{"color":"green"},"newsletter":true}. The result retains profile.name and active, changes profile.color, and adds newsletter. These are fictional values, not a schema or an access policy.
Read the RFC section ↗