datatracker.ietf.org
Sign in
Version 5.6.4.p1, 2014-10-20
Report a bug

JavaScript Object Notation (JSON) Patch
RFC 6902

Internet Engineering Task Force (IETF)                     P. Bryan, Ed.
Request for Comments: 6902                                Salesforce.com
Category: Standards Track                             M. Nottingham, Ed.
ISSN: 2070-1721                                                   Akamai
                                                              April 2013

                JavaScript Object Notation (JSON) Patch

Abstract

   JSON Patch defines a JSON document structure for expressing a
   sequence of operations to apply to a JavaScript Object Notation
   (JSON) document; it is suitable for use with the HTTP PATCH method.
   The "application/json-patch+json" media type is used to identify such
   patch documents.

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/rfc6902.

Copyright Notice

   Copyright (c) 2013 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.

Bryan & Nottingham           Standards Track                    [Page 1]
RFC 6902                       JSON Patch                     April 2013

Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  Conventions  . . . . . . . . . . . . . . . . . . . . . . . . .  3
   3.  Document Structure . . . . . . . . . . . . . . . . . . . . . .  3
   4.  Operations . . . . . . . . . . . . . . . . . . . . . . . . . .  4
     4.1.  add  . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
     4.2.  remove . . . . . . . . . . . . . . . . . . . . . . . . . .  6
     4.3.  replace  . . . . . . . . . . . . . . . . . . . . . . . . .  6
     4.4.  move . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
     4.5.  copy . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
     4.6.  test . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
   5.  Error Handling . . . . . . . . . . . . . . . . . . . . . . . .  8
   6.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . .  9
   7.  Security Considerations  . . . . . . . . . . . . . . . . . . . 10
   8.  Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 10
   9.  References . . . . . . . . . . . . . . . . . . . . . . . . . . 10
     9.1.  Normative References . . . . . . . . . . . . . . . . . . . 10
     9.2.  Informative References . . . . . . . . . . . . . . . . . . 10
   Appendix A.  Examples  . . . . . . . . . . . . . . . . . . . . . . 12
     A.1.  Adding an Object Member  . . . . . . . . . . . . . . . . . 12
     A.2.  Adding an Array Element  . . . . . . . . . . . . . . . . . 12
     A.3.  Removing an Object Member  . . . . . . . . . . . . . . . . 12
     A.4.  Removing an Array Element  . . . . . . . . . . . . . . . . 13
     A.5.  Replacing a Value  . . . . . . . . . . . . . . . . . . . . 13
     A.6.  Moving a Value . . . . . . . . . . . . . . . . . . . . . . 14
     A.7.  Moving an Array Element  . . . . . . . . . . . . . . . . . 14
     A.8.  Testing a Value: Success . . . . . . . . . . . . . . . . . 15
     A.9.  Testing a Value: Error . . . . . . . . . . . . . . . . . . 15
     A.10. Adding a Nested Member Object  . . . . . . . . . . . . . . 15
     A.11. Ignoring Unrecognized Elements . . . . . . . . . . . . . . 16
     A.12. Adding to a Nonexistent Target . . . . . . . . . . . . . . 16
     A.13. Invalid JSON Patch Document  . . . . . . . . . . . . . . . 17
     A.14. ~ Escape Ordering  . . . . . . . . . . . . . . . . . . . . 17
     A.15. Comparing Strings and Numbers  . . . . . . . . . . . . . . 17
     A.16. Adding an Array Value  . . . . . . . . . . . . . . . . . . 18

Bryan & Nottingham           Standards Track                    [Page 2]
RFC 6902                       JSON Patch                     April 2013

[include full document text]