| < draft-pbryan-zyp-json-pointer-01.txt | draft-pbryan-zyp-json-pointer-02.txt > | |||
|---|---|---|---|---|
| Internet Engineering Task Force P. Bryan, Ed. | Internet Engineering Task Force P. Bryan, Ed. | |||
| Internet-Draft ForgeRock US, Inc. | Internet-Draft ForgeRock US, Inc. | |||
| Intended status: Informational K. Zyp | Intended status: Informational K. Zyp | |||
| Expires: April 22, 2012 SitePen (USA) | Expires: April 23, 2012 SitePen (USA) | |||
| October 20, 2011 | October 21, 2011 | |||
| JSON Pointer | JSON Pointer | |||
| draft-pbryan-zyp-json-pointer-01 | draft-pbryan-zyp-json-pointer-02 | |||
| Abstract | Abstract | |||
| JSON Pointer defines a syntax for identifying a specific value within | JSON Pointer defines a syntax for identifying a specific value within | |||
| a JSON document. | 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 April 22, 2012. | This Internet-Draft will expire on April 23, 2012. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2011 IETF Trust and the persons identified as the | Copyright (c) 2011 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 2, line 15 ¶ | skipping to change at page 2, line 15 ¶ | |||
| Table of Contents | Table of Contents | |||
| 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
| 2. Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 3 | 2. Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
| 3. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 | 3. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
| 4. Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . 3 | 4. Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
| 5. Error Handling . . . . . . . . . . . . . . . . . . . . . . . . 4 | 5. Error Handling . . . . . . . . . . . . . . . . . . . . . . . . 4 | |||
| 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 4 | 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 4 | |||
| 7. Security Considerations . . . . . . . . . . . . . . . . . . . . 4 | 7. Security Considerations . . . . . . . . . . . . . . . . . . . . 4 | |||
| 8. Normative References . . . . . . . . . . . . . . . . . . . . . 4 | 8. Normative References . . . . . . . . . . . . . . . . . . . . . 4 | |||
| Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . . 4 | Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . . 5 | |||
| Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 5 | Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 5 | |||
| 1. Introduction | 1. Introduction | |||
| This specification defines JSON Pointer, a syntax for identifying a | This specification defines JSON Pointer, a syntax for identifying a | |||
| specific value within a JSON [RFC4627] text document. The syntax is | specific value within a JSON [RFC4627] text document. The syntax is | |||
| intended to be expressed in a JSON string value or the URI fragment | intended to be expressed in a JSON string value or the URI fragment | |||
| identifier of a resource that has a JSON representation. | identifier of a resource that has a JSON representation. | |||
| 2. Conventions | 2. Conventions | |||
| skipping to change at page 3, line 33 ¶ | skipping to change at page 3, line 33 ¶ | |||
| 3. Syntax | 3. Syntax | |||
| A JSON Pointer is a sequence of zero or more reference tokens, each | A JSON Pointer is a sequence of zero or more reference tokens, each | |||
| prefixed by a "/" (%x2F) character. Each reference token is a | prefixed by a "/" (%x2F) character. Each reference token is a | |||
| sequence of unreserved and/or percent-encoded characters, per | sequence of unreserved and/or percent-encoded characters, per | |||
| [RFC3986]. | [RFC3986]. | |||
| json-pointer = *( "/" reference-token ) | json-pointer = *( "/" reference-token ) | |||
| reference-token = *( unreserved / pct-encoded ) | reference-token = *( unreserved / pct-encoded ) | |||
| Unreserved characters in reference tokens SHOULD be percent-encoded, | Characters in reference tokens that are not unreserved SHOULD be | |||
| per [RFC3986], and MUST be so encoded as "%2F" if the character is | percent-encoded, per [RFC3986], and MUST be so encoded as "%2F" if | |||
| "/" to avoid being interpreted as a reference token prefix. | the character is "/" to avoid being interpreted as a reference token | |||
| prefix. | ||||
| It is an error condition if a JSON Pointer does not conform to this | It is an error condition if a JSON Pointer does not conform to this | |||
| syntax. | syntax. | |||
| 4. Evaluation | 4. Evaluation | |||
| Evaluation begins with a reference to the root value of a JSON text | Evaluation begins with a reference to the root value of a JSON text | |||
| document, and completes with a reference to some value within the | document, and completes with a reference to some value within the | |||
| same document. Each token in the JSON Pointer sequence is evaluated, | same document. Each token in the JSON Pointer sequence is evaluated, | |||
| changing the referenced value according to the following scheme: | changing the referenced value 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 property with the name identified by | referenced value is the object member with the name identified by the | |||
| the token. If the currently referenced value is a JSON array, the | token. | |||
| new referenced value is the array element with the zero-based index | ||||
| identified by the token. | If the currently referenced value is a JSON array, the token MUST | |||
| contain an unsigned base-10 integer value, and the new referenced | ||||
| value is the array element with the zero-based index identified by | ||||
| the token. | ||||
| If a reference token is being evaluated against a concrete JSON text | If a reference token is being evaluated against a concrete JSON text | |||
| document, the implementation MAY evaluate each token against the | document, the implementation MAY evaluate each token against a | |||
| currently referenced concrete value, and terminate evaluation with an | concrete value, and terminate evaluation with an error condition if a | |||
| error condition should a reference token fail to resolve to a | reference token fails to resolve to a concrete value. If a concrete | |||
| concrete value. | JSON object contains a referenced member with a non-unique name, | |||
| which of the matching members is resolved is undefined. | ||||
| 5. Error Handling | 5. 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. | |||
| 6. IANA Considerations | 6. IANA Considerations | |||
| This draft includes no request to IANA. | This draft includes no request to IANA. | |||
| skipping to change at page 5, line 4 ¶ | skipping to change at page 5, line 6 ¶ | |||
| Resource Identifier (URI): Generic Syntax", STD 66, | Resource Identifier (URI): Generic Syntax", STD 66, | |||
| RFC 3986, January 2005. | RFC 3986, January 2005. | |||
| [RFC4627] Crockford, D., "The application/json Media Type for | [RFC4627] Crockford, D., "The application/json Media Type for | |||
| JavaScript Object Notation (JSON)", RFC 4627, July 2006. | JavaScript Object Notation (JSON)", RFC 4627, July 2006. | |||
| [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax | [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax | |||
| Specifications: ABNF", STD 68, RFC 5234, January 2008. | Specifications: ABNF", STD 68, RFC 5234, January 2008. | |||
| Appendix A. Examples | Appendix A. Examples | |||
| The following examples illustrate the use of JSON pointers in URI | The following examples illustrate the use of JSON pointers in URI | |||
| fragments for a JSON text document located at | fragments for a JSON text document located at | |||
| http://example.com/example.json, with the following value: | http://example.com/example.json, with the following value: | |||
| { | { | |||
| "foo": { | "foo": { | |||
| "bar": [ "element0", "element1" ], | "bar": [ "element0", "element1" ], | |||
| "inner object": { | "inner object": { | |||
| "baz": "qux" | "baz": "qux" | |||
| } | } | |||
| } | } | |||
| http://example.com/example.json# | http://example.com/example.json# | |||
| Resolves to the object value at the root of the JSON text | Resolves to the object value at the root of the JSON text | |||
| document. | document. | |||
| http://example.com/example.json#/foo | http://example.com/example.json#/foo | |||
| Resolves to the object value of the "foo" property in the root | Resolves to the object value of the "foo" member in the root | |||
| object. | object. | |||
| http://example.com/example.json#/foo/inner%20object | http://example.com/example.json#/foo/inner%20object | |||
| Resolves to the object value of the "inner object" property in the | Resolves to the object value of the "inner object" member in the | |||
| "foo" object value in the root object. | "foo" object value in the root object. | |||
| http://example.com/example.json#/foo/inner%20object/baz | http://example.com/example.json#/foo/inner%20object/baz | |||
| Resolves to the string value "qux", which is the value of the | Resolves to the string value "qux", which is the value of the | |||
| "baz" property in the "inner object" property in the "foo" | "baz" member in the "inner object" member in the "foo" member in | |||
| property 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" property 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 US, Inc. | |||
| 201 NE Park Plaza Drive Suite 196 | 201 NE Park Plaza Drive Suite 196 | |||
| Vancouver, WA 98684 | Vancouver, WA 98684 | |||
| USA | USA | |||
| Phone: +1 604 783 1481 | Phone: +1 604 783 1481 | |||
| End of changes. 12 change blocks. | ||||
| 21 lines changed or deleted | 27 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/ | ||||