JSON Merge Patch
RFC 7386

Document Type RFC - Proposed Standard (October 2014; Errata)
Obsoleted by RFC 7396
Last updated 2015-10-14
Replaces draft-snell-merge-patch
Stream IETF
Formats plain text pdf html bibtex
Stream WG state Submitted to IESG for Publication Aug 2014
Document shepherd Murray Kucherawy
Shepherd write-up Show (last changed 2014-07-23)
IESG IESG state RFC 7386 (Proposed Standard)
Consensus Boilerplate Yes
Telechat date
Responsible AD Barry Leiba
Send notices to (None)
IANA IANA review state Version Changed - Review Needed
IANA action state RFC-Ed-Ack
Internet Engineering Task Force (IETF)                        P. Hoffman
Request for Comments: 7386                                VPN Consortium
Category: Standards Track                                       J. Snell
ISSN: 2070-1721                                             October 2014

                            JSON Merge Patch

Abstract

   This specification defines the JSON merge patch format and processing
   rules.  The merge patch format is primarily intended for use with the
   HTTP PATCH method as a means of describing a set of modifications to
   a target resource's content.

Status of This Memo

   This is an Internet Standards Track document.

   This document is a product of the Internet Engineering Task Force
   (IETF).  It represents the consensus of the IETF community.  It has
   received public review and has been approved for publication by the
   Internet Engineering Steering Group (IESG).  Further information on
   Internet Standards is available in Section 2 of RFC 5741.

   Information about the current status of this document, any errata,
   and how to provide feedback on it may be obtained at
   http://www.rfc-editor.org/info/rfc7386.

Copyright Notice

   Copyright (c) 2014 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Hoffman & Snell              Standards Track                    [Page 1]
RFC 7386                    JSON Merge Patch                October 2014

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  Processing Merge Patch Documents  . . . . . . . . . . . . . .   3
   3.  Example . . . . . . . . . . . . . . . . . . . . . . . . . . .   4
   4.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   5
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .   6
   6.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   7
     6.1.  Normative References  . . . . . . . . . . . . . . . . . .   7
     6.2.  Informative References  . . . . . . . . . . . . . . . . .   7
   Appendix A.  Example Test Cases . . . . . . . . . . . . . . . . .   8
   Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . .   9
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .   9

1.  Introduction

   This specification defines the JSON merge patch document format,
   processing rules, and associated MIME media type identifier.  The
   merge patch format is primarily intended for use with the HTTP PATCH
   method [RFC5789] as a means of describing a set of modifications to a
   target resource's content.

   A JSON merge patch document describes changes to be made to a target
   JSON document using a syntax that closely mimics the document being
   modified.  Recipients of a merge patch document determine the exact
   set of changes being requested by comparing the content of the
   provided patch against the current content of the target document.
   If the provided merge patch contains members that do not appear
   within the target, those members are added.  If the target does
   contain the member, the value is replaced.  Null values in the merge
   patch are given special meaning to indicate the removal of existing
   values in the target.

   For example, given the following original JSON document:

       {
         "a": "b",
         "c": {
       "d": "e",
       "f": "g"
         }
       }

Hoffman & Snell              Standards Track                    [Page 2]
RFC 7386                    JSON Merge Patch                October 2014

   Changing the value of "a" and removing "f" can be achieved by
   sending:

       PATCH /target HTTP/1.1
       Host: example.org
       Content-Type: application/merge-patch+json

       {
         "a":"z",
         "c": {
       "f": null
         }
       }

   When applied to the target resource, the value of the "a" member is
   replaced with "z" and "f" is removed, leaving the remaining content
   untouched.

   This design means that merge patch documents are suitable for
Show full document text