idnits 2.17.1 draft-pbryan-zyp-json-pointer-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (October 20, 2011) is 4565 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet Engineering Task Force P. Bryan, Ed. 3 Internet-Draft ForgeRock US, Inc. 4 Intended status: Informational K. Zyp 5 Expires: April 22, 2012 SitePen (USA) 6 October 20, 2011 8 JSON Pointer 9 draft-pbryan-zyp-json-pointer-01 11 Abstract 13 JSON Pointer defines a syntax for identifying a specific value within 14 a JSON document. 16 Status of this Memo 18 This Internet-Draft is submitted in full conformance with the 19 provisions of BCP 78 and BCP 79. 21 Internet-Drafts are working documents of the Internet Engineering 22 Task Force (IETF). Note that other groups may also distribute 23 working documents as Internet-Drafts. The list of current Internet- 24 Drafts is at http://datatracker.ietf.org/drafts/current/. 26 Internet-Drafts are draft documents valid for a maximum of six months 27 and may be updated, replaced, or obsoleted by other documents at any 28 time. It is inappropriate to use Internet-Drafts as reference 29 material or to cite them other than as "work in progress." 31 This Internet-Draft will expire on April 22, 2012. 33 Copyright Notice 35 Copyright (c) 2011 IETF Trust and the persons identified as the 36 document authors. All rights reserved. 38 This document is subject to BCP 78 and the IETF Trust's Legal 39 Provisions Relating to IETF Documents 40 (http://trustee.ietf.org/license-info) in effect on the date of 41 publication of this document. Please review these documents 42 carefully, as they describe your rights and restrictions with respect 43 to this document. Code Components extracted from this document must 44 include Simplified BSD License text as described in Section 4.e of 45 the Trust Legal Provisions and are provided without warranty as 46 described in the Simplified BSD License. 48 Table of Contents 50 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 51 2. Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 3 52 3. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 53 4. Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . 3 54 5. Error Handling . . . . . . . . . . . . . . . . . . . . . . . . 4 55 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 4 56 7. Security Considerations . . . . . . . . . . . . . . . . . . . . 4 57 8. Normative References . . . . . . . . . . . . . . . . . . . . . 4 58 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . . 4 59 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 5 61 1. Introduction 63 This specification defines JSON Pointer, a syntax for identifying a 64 specific value within a JSON [RFC4627] text document. The syntax is 65 intended to be expressed in a JSON string value or the URI fragment 66 identifier of a resource that has a JSON representation. 68 2. Conventions 70 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 71 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 72 document are to be interpreted as described in [RFC2119]. 74 This specification expresses syntax rules using ABNF [RFC5234] 75 (Augmented Backus-Naur Form) notation. Additionally, it uses the 76 following rules from URI syntax [RFC3986]: "unreserved" and "pct- 77 encoded". 79 3. Syntax 81 A JSON Pointer is a sequence of zero or more reference tokens, each 82 prefixed by a "/" (%x2F) character. Each reference token is a 83 sequence of unreserved and/or percent-encoded characters, per 84 [RFC3986]. 86 json-pointer = *( "/" reference-token ) 87 reference-token = *( unreserved / pct-encoded ) 89 Unreserved characters in reference tokens SHOULD be percent-encoded, 90 per [RFC3986], and MUST be so encoded as "%2F" if the character is 91 "/" to avoid being interpreted as a reference token prefix. 93 It is an error condition if a JSON Pointer does not conform to this 94 syntax. 96 4. Evaluation 98 Evaluation begins with a reference to the root value of a JSON text 99 document, and completes with a reference to some value within the 100 same document. Each token in the JSON Pointer sequence is evaluated, 101 changing the referenced value according to the following scheme: 103 If the currently referenced value is a JSON object, the new 104 referenced value is the object property with the name identified by 105 the token. If the currently referenced value is a JSON array, the 106 new referenced value is the array element with the zero-based index 107 identified by the token. 109 If a reference token is being evaluated against a concrete JSON text 110 document, the implementation MAY evaluate each token against the 111 currently referenced concrete value, and terminate evaluation with an 112 error condition should a reference token fail to resolve to a 113 concrete value. 115 5. Error Handling 117 In the event of an error condition, evaluation of the JSON Pointer 118 fails to complete. 120 6. IANA Considerations 122 This draft includes no request to IANA. 124 7. Security Considerations 126 A pointer is not guaranteed to resolve to a JSON value. 127 Implementations of JSON Pointer should be aware of this and take 128 appropriate precautions. 130 8. Normative References 132 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 133 Requirement Levels", BCP 14, RFC 2119, March 1997. 135 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 136 Resource Identifier (URI): Generic Syntax", STD 66, 137 RFC 3986, January 2005. 139 [RFC4627] Crockford, D., "The application/json Media Type for 140 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 142 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 143 Specifications: ABNF", STD 68, RFC 5234, January 2008. 145 Appendix A. Examples 146 The following examples illustrate the use of JSON pointers in URI 147 fragments for a JSON text document located at 148 http://example.com/example.json, with the following value: 150 { 151 "foo": { 152 "bar": [ "element0", "element1" ], 153 "inner object": { 154 "baz": "qux" 155 } 156 } 158 http://example.com/example.json# 159 Resolves to the object value at the root of the JSON text 160 document. 162 http://example.com/example.json#/foo 163 Resolves to the object value of the "foo" property in the root 164 object. 166 http://example.com/example.json#/foo/inner%20object 167 Resolves to the object value of the "inner object" property in the 168 "foo" object value in the root object. 170 http://example.com/example.json#/foo/inner%20object/baz 171 Resolves to the string value "qux", which is the value of the 172 "baz" property in the "inner object" property in the "foo" 173 property in the root object. 175 http://example.com/example.json#/foo/bar/0 176 Resolves to the string value "element0", which is the first value 177 in the "bar" array in the "foo" property in the root object. 179 Authors' Addresses 181 Paul C. Bryan (editor) 182 ForgeRock US, Inc. 183 201 NE Park Plaza Drive Suite 196 184 Vancouver, WA 98684 185 USA 187 Phone: +1 604 783 1481 188 Email: paul.bryan@forgerock.com 189 Kris Zyp 190 SitePen (USA) 191 530 Lytton Avenue 192 Palo Alto, CA 94301 193 USA 195 Phone: +1 650 968 8787 196 Email: kris@sitepen.com