| < draft-ietf-appsawg-json-pointer-00.txt | draft-ietf-appsawg-json-pointer-01.txt > | |||
|---|---|---|---|---|
| Applications Area Working Group P. Bryan, Ed. | Applications Area Working Group P. Bryan, Ed. | |||
| Internet-Draft ForgeRock US, Inc. | Internet-Draft ForgeRock | |||
| Intended status: Standards Track K. Zyp | Intended status: Informational K. Zyp | |||
| Expires: July 6, 2012 SitePen (USA) | Expires: September 10, 2012 SitePen (USA) | |||
| January 3, 2012 | March 9, 2012 | |||
| JSON Pointer | JSON Pointer | |||
| draft-ietf-appsawg-json-pointer-00 | draft-ietf-appsawg-json-pointer-01 | |||
| Abstract | Abstract | |||
| JSON Pointer defines a string syntax for identifying a specific value | JSON Pointer defines a string syntax for identifying a specific value | |||
| within a JSON document. | within a JSON document. | |||
| Status of this Memo | Status of this Memo | |||
| This Internet-Draft is submitted in full conformance with the | This Internet-Draft is submitted in full conformance with the | |||
| provisions of BCP 78 and BCP 79. | provisions of BCP 78 and BCP 79. | |||
| skipping to change at page 1, line 32 ¶ | skipping to change at page 1, line 32 ¶ | |||
| Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
| Task Force (IETF). Note that other groups may also distribute | Task Force (IETF). Note that other groups may also distribute | |||
| working documents as Internet-Drafts. The list of current Internet- | working documents as Internet-Drafts. The list of current Internet- | |||
| Drafts is at http://datatracker.ietf.org/drafts/current/. | Drafts is at http://datatracker.ietf.org/drafts/current/. | |||
| Internet-Drafts are draft documents valid for a maximum of six months | Internet-Drafts are draft documents valid for a maximum of six months | |||
| and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
| time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
| material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
| This Internet-Draft will expire on July 6, 2012. | This Internet-Draft will expire on September 10, 2012. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2012 IETF Trust and the persons identified as the | Copyright (c) 2012 IETF Trust and the persons identified as the | |||
| document authors. All rights reserved. | document authors. All rights reserved. | |||
| This document is subject to BCP 78 and the IETF Trust's Legal | This document is subject to BCP 78 and the IETF Trust's Legal | |||
| Provisions Relating to IETF Documents | Provisions Relating to IETF Documents | |||
| (http://trustee.ietf.org/license-info) in effect on the date of | (http://trustee.ietf.org/license-info) in effect on the date of | |||
| publication of this document. Please review these documents | publication of this document. Please review these documents | |||
| skipping to change at page 3, line 27 ¶ | skipping to change at page 3, line 27 ¶ | |||
| document are to be interpreted as described in [RFC2119]. | document are to be interpreted as described in [RFC2119]. | |||
| This specification expresses normative syntax rules using Augmented | This specification expresses normative syntax rules using Augmented | |||
| Backus-Naur Form [RFC5234] (ABNF) notation. | Backus-Naur Form [RFC5234] (ABNF) notation. | |||
| 3. Syntax | 3. Syntax | |||
| A JSON Pointer is a [Unicode] string containing a sequence of zero or | A JSON Pointer is a [Unicode] string containing a sequence of zero or | |||
| more reference tokens, each prefixed by a '/' (%x2F) character. | more reference tokens, each prefixed by a '/' (%x2F) character. | |||
| If a reference token contains '/' (%x2F) or '\' (%x5C) characters, | If a reference token contains '/' (%x2F) or '^' (%x5E) characters, | |||
| such characters MUST each be prefixed (escaped) with a '\' (%x5C) | such characters MUST each be prefixed (escaped) with a '^' (%x5E) | |||
| character. | character. | |||
| ABNF syntax: | ABNF syntax: | |||
| json-pointer = *( "/" reference-token ) | json-pointer = *( "/" reference-token ) | |||
| reference-token = *( unescaped / escaped ) | reference-token = *( unescaped / escaped ) | |||
| unescaped = %x00-2E / %x30-5B / %x5D-10FFFF | unescaped = %x00-2E / %x30-5B / %x5D-10FFFF | |||
| escaped = "\" ( "/" / "\" ) | escaped = "^" ( "/" / "^" ) | |||
| It is an error condition if a JSON Pointer value does not conform to | It is an error condition if a JSON Pointer value does not conform to | |||
| this syntax. | this syntax. | |||
| 4. Evaluation | 4. Evaluation | |||
| Evaluation of a JSON Pointer begins with a reference to the root | Evaluation of a JSON Pointer begins with a reference to the root | |||
| value of a JSON text document and completes with a reference to some | value of a JSON text document and completes with a reference to some | |||
| value within the document. Each reference token in the JSON Pointer | value within the document. Each reference token in the JSON Pointer | |||
| is sequentially evaluated. | is sequentially evaluated. | |||
| Evaluation of each reference token begins by unescaping any escaped | Evaluation of each reference token begins by unescaping any escaped | |||
| character sequence; this is performed by simply the '\' (escape) | character sequence; this is performed by removing the '^' (escape) | |||
| prefix. The reference token then modifies which value is referenced | prefix. The reference token then modifies which value is referenced | |||
| according to the following scheme: | according to the following scheme: | |||
| If the currently referenced value is a JSON object, the new | If the currently referenced value is a JSON object, the new | |||
| referenced value is the object member with the name identified by | referenced value is the object member with the name identified by | |||
| the reference token. If a referenced member name is not unique, | the reference token. The member name is equal to the token if it | |||
| which member is referenced is undefined. | has the same number of Unicode characters as token and their | |||
| codepoints are positionwise equal. If a referenced member name is | ||||
| not unique in an object, the member that is referenced is | ||||
| undefined. | ||||
| If the currently referenced value is a JSON array, the reference | If the currently referenced value is a JSON array, the reference | |||
| token MUST contain an unsigned base-10 integer value, and the new | token MUST contain characters that represent an unsigned base-10 | |||
| referenced value is the array element with the zero-based index | integer value, and the new referenced value is the array element | |||
| identified by the token. | with the zero-based index identified by the token. | |||
| If a reference token is being evaluated against a concrete JSON | If a reference token is being evaluated against a JSON document, the | |||
| document, the implementation MAY evaluate each token against a | implementation MAY evaluate each token against a concrete value, and | |||
| concrete value, and terminate evaluation with an error condition if a | terminate evaluation with an error condition if a evaluation fails to | |||
| evaluation fails to resolve a concrete value. | resolve a concrete value. | |||
| 5. JSON String Representation | 5. JSON String Representation | |||
| A JSON Pointer MAY be represented in a JSON string value. Per | A JSON Pointer MAY be represented in a JSON string value. Per | |||
| [RFC4627], section 2.5, all instances of quotation mark '"' (%x22), | [RFC4627], section 2.5, all instances of quotation mark '"' (%x22), | |||
| reverse solidus '\' (%x5C) and control (%x00-1F) characters MUST be | reverse solidus '\' (%x5C) and control (%x00-1F) characters MUST be | |||
| escaped. | escaped. | |||
| 6. URI Fragment Identifier Representation | 6. URI Fragment Identifier Representation | |||
| A JSON Pointer MAY be represented in a URI fragment identifier. The | A JSON Pointer MAY be represented in a URI fragment identifier. The | |||
| JSON pointer MUST be UTF-8 [RFC3629] encoded as octets; octets in the | JSON pointer MUST be UTF-8 [RFC3629] encoded as octets; octets not in | |||
| URI "unreserved" set SHOULD be percent-encoded, per [RFC3986], | the URI "unreserved" set SHOULD be percent-encoded, per [RFC3986], | |||
| section 2.5. | section 2.5. | |||
| 7. Error Handling | 7. Error Handling | |||
| In the event of an error condition, evaluation of the JSON Pointer | In the event of an error condition, evaluation of the JSON Pointer | |||
| fails to complete. | fails to complete. | |||
| 8. IANA Considerations | 8. IANA Considerations | |||
| This document has no IANA actions. | This document has no IANA actions. | |||
| skipping to change at page 5, line 16 ¶ | skipping to change at page 5, line 16 ¶ | |||
| A given JSON Pointer is not guaranteed to reference an actual JSON | A given JSON Pointer is not guaranteed to reference an actual JSON | |||
| value. Implementations should be aware of this and take appropriate | value. Implementations should be aware of this and take appropriate | |||
| precautions. | precautions. | |||
| 10. Acknowledgements | 10. Acknowledgements | |||
| The following individuals contributed ideas, feedback and wording, | The following individuals contributed ideas, feedback and wording, | |||
| which contributed to the content of this specification: | which contributed to the content of this specification: | |||
| Carsten Bormann, Jacob Davies, Martin J. Duerst, Bjoern Hoehrmann, | Mike Acar, Carsten Bormann, Tim Bray, Jacob Davies, Martin J. | |||
| Mark Nottingham, Drew Perttula, Julian Reschke. | Duerst, Bjoern Hoehrmann, James H. Manger, Mark Nottingham, Drew | |||
| Perttula, Julian Reschke. | ||||
| 11. Normative References | 11. Normative References | |||
| [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | |||
| Requirement Levels", BCP 14, RFC 2119, March 1997. | Requirement Levels", BCP 14, RFC 2119, March 1997. | |||
| [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO | [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO | |||
| 10646", STD 63, RFC 3629, November 2003. | 10646", STD 63, RFC 3629, November 2003. | |||
| [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform | [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform | |||
| skipping to change at page 6, line 40 ¶ | skipping to change at page 6, line 40 ¶ | |||
| "baz" member in the "inner object" member in the "foo" member in | "baz" member in the "inner object" member in the "foo" member in | |||
| the root object. | the root object. | |||
| http://example.com/example.json#/foo/bar/0 | http://example.com/example.json#/foo/bar/0 | |||
| Resolves to the string value "element0", which is the first value | Resolves to the string value "element0", which is the first value | |||
| in the "bar" array in the "foo" member in the root object. | in the "bar" array in the "foo" member in the root object. | |||
| Authors' Addresses | Authors' Addresses | |||
| Paul C. Bryan (editor) | Paul C. Bryan (editor) | |||
| ForgeRock US, Inc. | ForgeRock | |||
| 201 NE Park Plaza Drive Suite 196 | ||||
| Vancouver, WA 98684 | ||||
| USA | ||||
| Phone: +1 604 783 1481 | Phone: +1 604 783 1481 | |||
| Email: paul.bryan@forgerock.com | Email: pbryan@anode.ca | |||
| Kris Zyp | Kris Zyp | |||
| SitePen (USA) | SitePen (USA) | |||
| 530 Lytton Avenue | ||||
| Palo Alto, CA 94301 | ||||
| USA | ||||
| Phone: +1 650 968 8787 | Phone: +1 650 968 8787 | |||
| Email: kris@sitepen.com | Email: kris@sitepen.com | |||
| End of changes. 14 change blocks. | ||||
| 31 lines changed or deleted | 29 lines changed or added | |||
This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ | ||||