Skip to main content

JSON Merge Patch
RFC 7396

Document Type RFC - Proposed Standard (October 2014)
Obsoletes RFC 7386
Authors James M. Snell , Paul E. Hoffman
Last updated 2014-10-31
RFC stream Internet Engineering Task Force (IETF)
Formats
Additional resources Mailing list discussion
IESG Responsible AD (None)
Send notices to (None)
RFC 7396
Security considerations: As defined in this specification

      Published specification: This specification.

      Applications that use this media type: None currently known.

      Additional information:

         Magic number(s): N/A

         File extension(s): N/A

         Macintosh file type code(s): TEXT

      Person & email address to contact for further information: IESG

      Intended usage: COMMON

      Restrictions on usage: None

      Author: James M. Snell <jasnell@gmail.com>

      Change controller: IESG

5.  Security Considerations

   The "application/merge-patch+json" media type allows user agents to
   indicate their intention for the server to determine the specific set
   of change operations to be applied to a target resource.  As such, it
   is the server's responsibility to determine the appropriateness of
   any given change as well as the user agent's authorization to request
   such changes.  How such determinations are made is considered out of
   the scope of this specification.

   All of the security considerations discussed in Section 5 of
   [RFC5789] apply to all uses of the HTTP PATCH method with the
   "application/merge-patch+json" media type.

Hoffman & Snell              Standards Track                    [Page 6]
RFC 7396                    JSON Merge Patch                October 2014

6.  References

6.1.  Normative References

   [RFC7159]  Bray, T., "The JavaScript Object Notation (JSON) Data
              Interchange Format", RFC 7159, March 2014,
              <http://www.rfc-editor.org/info/rfc7159>.

6.2.  Informative References

   [RFC5789]  Dusseault, L. and J. Snell, "PATCH Method for HTTP", RFC
              5789, March 2010,
              <http://www.rfc-editor.org/info/rfc5789>.

Hoffman & Snell              Standards Track                    [Page 7]
RFC 7396                    JSON Merge Patch                October 2014

Appendix A.  Example Test Cases

   ORIGINAL        PATCH            RESULT
   ------------------------------------------
   {"a":"b"}       {"a":"c"}       {"a":"c"}

   {"a":"b"}       {"b":"c"}       {"a":"b",
                                    "b":"c"}

   {"a":"b"}       {"a":null}      {}

   {"a":"b",       {"a":null}      {"b":"c"}
    "b":"c"}

   {"a":["b"]}     {"a":"c"}       {"a":"c"}

   {"a":"c"}       {"a":["b"]}     {"a":["b"]}

   {"a": {         {"a": {         {"a": {
     "b": "c"}       "b": "d",       "b": "d"
   }                 "c": null}      }
                   }               }

   {"a": [         {"a": [1]}      {"a": [1]}
     {"b":"c"}
    ]
   }

   ["a","b"]       ["c","d"]       ["c","d"]

   {"a":"b"}       ["c"]           ["c"]

   {"a":"foo"}     null            null

   {"a":"foo"}     "bar"           "bar"

   {"e":null}      {"a":1}         {"e":null,
                                    "a":1}

   [1,2]           {"a":"b",       {"a":"b"}
                    "c":null}

   {}              {"a":            {"a":
                    {"bb":           {"bb":
                     {"ccc":          {}}}
                      null}}}

Hoffman & Snell              Standards Track                    [Page 8]
RFC 7396                    JSON Merge Patch                October 2014

Acknowledgments

   Many people contributed significant ideas to this document.  These
   people include, but are not limited to, James Manger, Matt Miller,
   Carsten Bormann, Bjoern Hoehrmann, Pete Resnick, and Richard Barnes.

Authors' Addresses

   Paul Hoffman
   VPN Consortium

   EMail: paul.hoffman@vpnc.org

   James M. Snell

   EMail: jasnell@gmail.com

Hoffman & Snell              Standards Track                    [Page 9]