idnits 2.17.1 draft-ietf-appsawg-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 (March 9, 2012) is 4428 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 Applications Area Working Group P. Bryan, Ed. 3 Internet-Draft ForgeRock 4 Intended status: Informational K. Zyp 5 Expires: September 10, 2012 SitePen (USA) 6 March 9, 2012 8 JSON Pointer 9 draft-ietf-appsawg-json-pointer-01 11 Abstract 13 JSON Pointer defines a string syntax for identifying a specific value 14 within 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 September 10, 2012. 33 Copyright Notice 35 Copyright (c) 2012 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. JSON String Representation . . . . . . . . . . . . . . . . . . 4 55 6. URI Fragment Identifier Representation . . . . . . . . . . . . 4 56 7. Error Handling . . . . . . . . . . . . . . . . . . . . . . . . 4 57 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 4 58 9. Security Considerations . . . . . . . . . . . . . . . . . . . . 5 59 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 5 60 11. Normative References . . . . . . . . . . . . . . . . . . . . . 5 61 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . . 5 62 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 6 64 1. Introduction 66 This specification defines JSON Pointer, a string syntax for 67 identifying a specific value within a JavaScript Object Notation 68 (JSON) [RFC4627] text document. This syntax is intended to be easily 69 expressed in JSON string values and Uniform Resource Identifier (URI) 70 [RFC3986] fragment identifiers. 72 2. Conventions 74 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 75 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 76 document are to be interpreted as described in [RFC2119]. 78 This specification expresses normative syntax rules using Augmented 79 Backus-Naur Form [RFC5234] (ABNF) notation. 81 3. Syntax 83 A JSON Pointer is a [Unicode] string containing a sequence of zero or 84 more reference tokens, each prefixed by a '/' (%x2F) character. 86 If a reference token contains '/' (%x2F) or '^' (%x5E) characters, 87 such characters MUST each be prefixed (escaped) with a '^' (%x5E) 88 character. 90 ABNF syntax: 92 json-pointer = *( "/" reference-token ) 93 reference-token = *( unescaped / escaped ) 94 unescaped = %x00-2E / %x30-5B / %x5D-10FFFF 95 escaped = "^" ( "/" / "^" ) 97 It is an error condition if a JSON Pointer value does not conform to 98 this syntax. 100 4. Evaluation 102 Evaluation of a JSON Pointer begins with a reference to the root 103 value of a JSON text document and completes with a reference to some 104 value within the document. Each reference token in the JSON Pointer 105 is sequentially evaluated. 107 Evaluation of each reference token begins by unescaping any escaped 108 character sequence; this is performed by removing the '^' (escape) 109 prefix. The reference token then modifies which value is referenced 110 according to the following scheme: 112 If the currently referenced value is a JSON object, the new 113 referenced value is the object member with the name identified by 114 the reference token. The member name is equal to the token if it 115 has the same number of Unicode characters as token and their 116 codepoints are positionwise equal. If a referenced member name is 117 not unique in an object, the member that is referenced is 118 undefined. 120 If the currently referenced value is a JSON array, the reference 121 token MUST contain characters that represent an unsigned base-10 122 integer value, and the new referenced value is the array element 123 with the zero-based index identified by the token. 125 If a reference token is being evaluated against a JSON document, the 126 implementation MAY evaluate each token against a concrete value, and 127 terminate evaluation with an error condition if a evaluation fails to 128 resolve a concrete value. 130 5. JSON String Representation 132 A JSON Pointer MAY be represented in a JSON string value. Per 133 [RFC4627], section 2.5, all instances of quotation mark '"' (%x22), 134 reverse solidus '\' (%x5C) and control (%x00-1F) characters MUST be 135 escaped. 137 6. URI Fragment Identifier Representation 139 A JSON Pointer MAY be represented in a URI fragment identifier. The 140 JSON pointer MUST be UTF-8 [RFC3629] encoded as octets; octets not in 141 the URI "unreserved" set SHOULD be percent-encoded, per [RFC3986], 142 section 2.5. 144 7. Error Handling 146 In the event of an error condition, evaluation of the JSON Pointer 147 fails to complete. 149 8. IANA Considerations 151 This document has no IANA actions. 153 9. Security Considerations 155 A given JSON Pointer is not guaranteed to reference an actual JSON 156 value. Implementations should be aware of this and take appropriate 157 precautions. 159 10. Acknowledgements 161 The following individuals contributed ideas, feedback and wording, 162 which contributed to the content of this specification: 164 Mike Acar, Carsten Bormann, Tim Bray, Jacob Davies, Martin J. 165 Duerst, Bjoern Hoehrmann, James H. Manger, Mark Nottingham, Drew 166 Perttula, Julian Reschke. 168 11. Normative References 170 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 171 Requirement Levels", BCP 14, RFC 2119, March 1997. 173 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 174 10646", STD 63, RFC 3629, November 2003. 176 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 177 Resource Identifier (URI): Generic Syntax", STD 66, 178 RFC 3986, January 2005. 180 [RFC4627] Crockford, D., "The application/json Media Type for 181 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 183 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 184 Specifications: ABNF", STD 68, RFC 5234, January 2008. 186 [Unicode] The Unicode Consortium, "The Unicode Standard, Version 187 6.0", October 2011, 188 . 190 Appendix A. Examples 191 The following examples illustrate the use of JSON Pointers in URI 192 fragments for a JSON text document located at 193 http://example.com/example.json, with the following value: 195 { 196 "foo": { 197 "bar": [ "element0", "element1" ], 198 "inner object": { 199 "baz": "qux" 200 } 201 } 203 http://example.com/example.json# 204 Resolves to the object value at the root of the JSON text 205 document. 207 http://example.com/example.json#/foo 208 Resolves to the object value of the "foo" member in the root 209 object. 211 http://example.com/example.json#/foo/inner%20object 212 Resolves to the object value of the "inner object" member in the 213 "foo" object value in the root object. 215 http://example.com/example.json#/foo/inner%20object/baz 216 Resolves to the string value "qux", which is the value of the 217 "baz" member in the "inner object" member in the "foo" member in 218 the root object. 220 http://example.com/example.json#/foo/bar/0 221 Resolves to the string value "element0", which is the first value 222 in the "bar" array in the "foo" member in the root object. 224 Authors' Addresses 226 Paul C. Bryan (editor) 227 ForgeRock 229 Phone: +1 604 783 1481 230 Email: pbryan@anode.ca 231 Kris Zyp 232 SitePen (USA) 234 Phone: +1 650 968 8787 235 Email: kris@sitepen.com