idnits 2.17.1 draft-ietf-appsawg-json-pointer-00.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 (January 3, 2012) is 4496 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) -- Possible downref: Non-RFC (?) normative reference: ref. 'Unicode' Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 2 comments (--). 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 US, Inc. 4 Intended status: Standards Track K. Zyp 5 Expires: July 6, 2012 SitePen (USA) 6 January 3, 2012 8 JSON Pointer 9 draft-ietf-appsawg-json-pointer-00 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 July 6, 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 '\' (%x5C) characters, 87 such characters MUST each be prefixed (escaped) with a '\' (%x5C) 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 simply 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. If a referenced member name is not unique, 115 which member is referenced is undefined. 117 If the currently referenced value is a JSON array, the reference 118 token MUST contain an unsigned base-10 integer value, and the new 119 referenced value is the array element with the zero-based index 120 identified by the token. 122 If a reference token is being evaluated against a concrete JSON 123 document, the implementation MAY evaluate each token against a 124 concrete value, and terminate evaluation with an error condition if a 125 evaluation fails to resolve a concrete value. 127 5. JSON String Representation 129 A JSON Pointer MAY be represented in a JSON string value. Per 130 [RFC4627], section 2.5, all instances of quotation mark '"' (%x22), 131 reverse solidus '\' (%x5C) and control (%x00-1F) characters MUST be 132 escaped. 134 6. URI Fragment Identifier Representation 136 A JSON Pointer MAY be represented in a URI fragment identifier. The 137 JSON pointer MUST be UTF-8 [RFC3629] encoded as octets; octets in the 138 URI "unreserved" set SHOULD be percent-encoded, per [RFC3986], 139 section 2.5. 141 7. Error Handling 143 In the event of an error condition, evaluation of the JSON Pointer 144 fails to complete. 146 8. IANA Considerations 148 This document has no IANA actions. 150 9. Security Considerations 152 A given JSON Pointer is not guaranteed to reference an actual JSON 153 value. Implementations should be aware of this and take appropriate 154 precautions. 156 10. Acknowledgements 158 The following individuals contributed ideas, feedback and wording, 159 which contributed to the content of this specification: 161 Carsten Bormann, Jacob Davies, Martin J. Duerst, Bjoern Hoehrmann, 162 Mark Nottingham, Drew Perttula, Julian Reschke. 164 11. Normative References 166 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 167 Requirement Levels", BCP 14, RFC 2119, March 1997. 169 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 170 10646", STD 63, RFC 3629, November 2003. 172 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 173 Resource Identifier (URI): Generic Syntax", STD 66, 174 RFC 3986, January 2005. 176 [RFC4627] Crockford, D., "The application/json Media Type for 177 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 179 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 180 Specifications: ABNF", STD 68, RFC 5234, January 2008. 182 [Unicode] The Unicode Consortium, "The Unicode Standard, Version 183 6.0", October 2011, 184 . 186 Appendix A. Examples 187 The following examples illustrate the use of JSON Pointers in URI 188 fragments for a JSON text document located at 189 http://example.com/example.json, with the following value: 191 { 192 "foo": { 193 "bar": [ "element0", "element1" ], 194 "inner object": { 195 "baz": "qux" 196 } 197 } 199 http://example.com/example.json# 200 Resolves to the object value at the root of the JSON text 201 document. 203 http://example.com/example.json#/foo 204 Resolves to the object value of the "foo" member in the root 205 object. 207 http://example.com/example.json#/foo/inner%20object 208 Resolves to the object value of the "inner object" member in the 209 "foo" object value in the root object. 211 http://example.com/example.json#/foo/inner%20object/baz 212 Resolves to the string value "qux", which is the value of the 213 "baz" member in the "inner object" member in the "foo" member in 214 the root object. 216 http://example.com/example.json#/foo/bar/0 217 Resolves to the string value "element0", which is the first value 218 in the "bar" array in the "foo" member in the root object. 220 Authors' Addresses 222 Paul C. Bryan (editor) 223 ForgeRock US, Inc. 224 201 NE Park Plaza Drive Suite 196 225 Vancouver, WA 98684 226 USA 228 Phone: +1 604 783 1481 229 Email: paul.bryan@forgerock.com 230 Kris Zyp 231 SitePen (USA) 232 530 Lytton Avenue 233 Palo Alto, CA 94301 234 USA 236 Phone: +1 650 968 8787 237 Email: kris@sitepen.com