[要約] RFC 6901は、JSONデータ内の特定の値を指し示すためのポインタの構文とセマンティクスを定義しています。このRFCの目的は、JSONデータ内の特定の値に簡単にアクセスするための標準化された方法を提供することです。

Internet Engineering Task Force (IETF)                     P. Bryan, Ed.
Request for Comments: 6901                                Salesforce.com
Category: Standards Track                                         K. Zyp
ISSN: 2070-1721                                            SitePen (USA)
                                                      M. Nottingham, Ed.
                                                                  Akamai
                                                              April 2013
        

JavaScript Object Notation (JSON) Pointer

JavaScript Object Notation(JSON)ポインター

Abstract

概要

JSON Pointer defines a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document.

JSONポインターは、JavaScript Object Notation(JSON)ドキュメント内の特定の値を識別するための文字列構文を定義します。

Status of This Memo

本文書の状態

This is an Internet Standards Track document.

これはInternet Standards Trackドキュメントです。

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.

このドキュメントは、IETF(Internet Engineering Task Force)の製品です。これは、IETFコミュニティのコンセンサスを表しています。公開レビューを受け、インターネットエンジニアリングステアリンググループ(IESG)による公開が承認されました。インターネット標準の詳細については、RFC 5741のセクション2をご覧ください。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc6901.

このドキュメントの現在のステータス、正誤表、およびフィードバックの提供方法に関する情報は、http://www.rfc-editor.org/info/rfc6901で入手できます。

Copyright Notice

著作権表示

Copyright (c) 2013 IETF Trust and the persons identified as the document authors. All rights reserved.

Copyright(c)2013 IETF Trustおよびドキュメントの作成者として識別された人物。全著作権所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

この文書は、BCP 78およびこの文書の発行日に有効なIETF文書に関するIETFトラストの法的規定(http://trustee.ietf.org/license-info)の対象となります。これらのドキュメントは、このドキュメントに関するあなたの権利と制限を説明しているため、注意深く確認してください。このドキュメントから抽出されたコードコンポーネントには、Trust Legal Provisionsのセクション4.eに記載されているSimplified BSD Licenseのテキストが含まれている必要があり、Simplified BSD Licenseに記載されているように保証なしで提供されます。

Table of Contents

目次

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . 2
   2.  Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 2
   3.  Syntax  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
   4.  Evaluation  . . . . . . . . . . . . . . . . . . . . . . . . . . 3
   5.  JSON String Representation  . . . . . . . . . . . . . . . . . . 4
   6.  URI Fragment Identifier Representation  . . . . . . . . . . . . 5
   7.  Error Handling  . . . . . . . . . . . . . . . . . . . . . . . . 6
   8.  Security Considerations . . . . . . . . . . . . . . . . . . . . 6
   9.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . 7
   10. References  . . . . . . . . . . . . . . . . . . . . . . . . . . 7
     10.1.  Normative References . . . . . . . . . . . . . . . . . . . 7
     10.2.  Informative References . . . . . . . . . . . . . . . . . . 7
        
1. Introduction
1. はじめに

This specification defines JSON Pointer, a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document [RFC4627]. JSON Pointer is intended to be easily expressed in JSON string values as well as Uniform Resource Identifier (URI) [RFC3986] fragment identifiers.

この仕様は、JavaScript Object Notation(JSON)ドキュメント[RFC4627]内の特定の値を識別するための文字列構文であるJSONポインターを定義しています。 JSONポインターは、JSON文字列値とUniform Resource Identifier(URI)[RFC3986]フラグメント識別子で簡単に表現されることを目的としています。

2. Conventions
2. 規約

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

このドキュメントのキーワード「MUST」、「MUST NOT」、「REQUIRED」、「SHALL」、「SHALL NOT」、「SHOULD」、「SHOULD NOT」、「RECOMMENDED」、「MAY」、および「OPTIONAL」は、 [RFC2119]で説明されているように解釈されます。

This specification expresses normative syntax rules using Augmented Backus-Naur Form (ABNF) [RFC5234] notation.

この仕様は、拡張バッカスナウアフォーム(ABNF)[RFC5234]表記を使用して、規範的な構文規則を表現しています。

3. Syntax
3. 構文

A JSON Pointer is a Unicode string (see [RFC4627], Section 3) containing a sequence of zero or more reference tokens, each prefixed by a '/' (%x2F) character.

JSONポインタは、ゼロまたは1つ以上の参照トークンのシーケンスを含むUnicode文字列([RFC4627]、セクション3を参照)であり、それぞれに「/」(%x2F)文字が前に付いています。

Because the characters '~' (%x7E) and '/' (%x2F) have special meanings in JSON Pointer, '~' needs to be encoded as '~0' and '/' needs to be encoded as '~1' when these characters appear in a reference token.

文字 '〜'(%x7E)および '/'(%x2F)はJSONポインターで特別な意味を持つため、 '〜'は '〜0'としてエンコードする必要があり、 '/'は '〜1'としてエンコードする必要がありますこれらの文字が参照トークンに現れるとき。

The ABNF syntax of a JSON Pointer is:

JSONポインターのABNF構文は次のとおりです。

      json-pointer    = *( "/" reference-token )
      reference-token = *( unescaped / escaped )
      unescaped       = %x00-2E / %x30-7D / %x7F-10FFFF
         ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'
      escaped         = "~" ( "0" / "1" )
        ; representing '~' and '/', respectively
        

It is an error condition if a JSON Pointer value does not conform to this syntax (see Section 7).

JSONポインター値がこの構文に準拠していない場合、エラー状態になります(セクション7を参照)。

Note that JSON Pointers are specified in characters, not as bytes.

JSONポインターは、バイトではなく文字で指定されることに注意してください。

4. Evaluation
4. 評価

Evaluation of a JSON Pointer begins with a reference to the root value of a JSON document and completes with a reference to some value within the document. Each reference token in the JSON Pointer is evaluated sequentially.

JSONポインターの評価は、JSONドキュメントのルート値への参照で始まり、ドキュメント内のある値への参照で完了します。 JSONポインターの各参照トークンは順次評価されます。

Evaluation of each reference token begins by decoding any escaped character sequence. This is performed by first transforming any occurrence of the sequence '~1' to '/', and then transforming any occurrence of the sequence '~0' to '~'. By performing the substitutions in this order, an implementation avoids the error of turning '~01' first into '~1' and then into '/', which would be incorrect (the string '~01' correctly becomes '~1' after transformation).

各参照トークンの評価は、エスケープされた文字シーケンスをデコードすることから始まります。これは、最初にシーケンス「〜1」の出現を「/」に変換し、次にシーケンス「〜0」の出現を「〜」に変換することによって実行されます。この順序で置換を実行することにより、実装は最初に '〜01'を '〜1'にしてから '/'に変えるというエラーを回避しますが、これは正しくありません(文字列 '〜01'は後に '〜1'になります)変換)。

The reference token then modifies which value is referenced according to the following scheme:

次に、参照トークンは、次のスキームに従って参照される値を変更します。

o If the currently referenced value is a JSON object, the new referenced value is the object member with the name identified by the reference token. The member name is equal to the token if it has the same number of Unicode characters as the token and their code points are byte-by-byte equal. No Unicode character normalization is performed. If a referenced member name is not unique in an object, the member that is referenced is undefined, and evaluation fails (see below).

o 現在参照されている値がJSONオブジェクトの場合、新しい参照値は、参照トークンで識別された名前のオブジェクトメンバーです。メンバー名は、トークンと同じ数のUnicode文字を持ち、そのコードポイントがバイトごとに等しい場合、トークンと同じです。 Unicode文字の正規化は実行されません。参照されるメンバー名がオブジェクト内で一意でない場合、参照されるメンバーは未定義であり、評価は失敗します(以下を参照)。

o If the currently referenced value is a JSON array, the reference token MUST contain either:

o 現在参照されている値がJSON配列の場合、参照トークンには次のいずれかが含まれている必要があります。

* characters comprised of digits (see ABNF below; note that leading zeros are not allowed) that represent an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index identified by the token, or

* 符号なしの基数10の整数値を表す数字で構成される文字(以下のABNFを参照。先行ゼロは許可されないことに注意)。新しい参照値を、トークンで識別されるゼロベースのインデックスを持つ配列要素にします。

* exactly the single character "-", making the new referenced value the (nonexistent) member after the last array element.

* 正確に単一の文字「-」。新しい参照値を、最後の配列要素の後の(存在しない)メンバーにします。

The ABNF syntax for array indices is:

配列インデックスのABNF構文は次のとおりです。

   array-index = %x30 / ( %x31-39 *(%x30-39) )
                 ; "0", or digits without a leading "0"
        

Implementations will evaluate each reference token against the document's contents and will raise an error condition if it fails to resolve a concrete value for any of the JSON pointer's reference tokens. For example, if an array is referenced with a non-numeric token, an error condition will be raised. See Section 7 for details.

実装は、ドキュメントのコンテンツに対して各参照トークンを評価し、JSONポインターの参照トークンの具体的な値を解決できない場合はエラー条件を発生させます。たとえば、配列が数値以外のトークンで参照されている場合、エラー条件が発生します。詳細については、セクション7を参照してください。

Note that the use of the "-" character to index an array will always result in such an error condition because by definition it refers to a nonexistent array element. Thus, applications of JSON Pointer need to specify how that character is to be handled, if it is to be useful.

「-」文字を使用して配列にインデックスを付けると、定義上、存在しない配列要素を参照するため、常にこのようなエラー状態が発生することに注意してください。したがって、JSONポインターのアプリケーションは、その文字が役立つ場合、その文字の処理方法を指定する必要があります。

Any error condition for which a specific action is not defined by the JSON Pointer application results in termination of evaluation.

JSONポインターアプリケーションで特定のアクションが定義されていないエラー条件があると、評価が終了します。

5. JSON String Representation
5. JSON文字列表現

A JSON Pointer can be represented in a JSON string value. Per [RFC4627], Section 2.5, all instances of quotation mark '"' (%x22), reverse solidus '\' (%x5C), and control (%x00-1F) characters MUST be escaped.

JSONポインターは、JSON文字列値で表すことができます。 [RFC4627]、セクション2.5に従って、引用符「」(%x22)、逆ソリダス「\」(%x5C)、および制御文字(%x00-1F)のすべてのインスタンスはエスケープする必要があります。

Note that before processing a JSON string as a JSON Pointer, backslash escape sequences must be unescaped.

JSON文字列をJSONポインターとして処理する前に、バックスラッシュエスケープシーケンスのエスケープを解除する必要があります。

For example, given the JSON document

たとえば、JSONドキュメントがあるとします。

   {
      "foo": ["bar", "baz"],
      "": 0,
      "a/b": 1,
      "c%d": 2,
      "e^f": 3,
      "g|h": 4,
      "i\\j": 5,
      "k\"l": 6,
      " ": 7,
      "m~n": 8
   }
        

The following JSON strings evaluate to the accompanying values:

次のJSON文字列は、付随する値に評価されます。

    ""           // the whole document
    "/foo"       ["bar", "baz"]
    "/foo/0"     "bar"
    "/"          0
    "/a~1b"      1
    "/c%d"       2
    "/e^f"       3
    "/g|h"       4
    "/i\\j"      5
    "/k\"l"      6
    "/ "         7
    "/m~0n"      8
        
6. URI Fragment Identifier Representation
6. URIフラグメント識別子の表現

A JSON Pointer can be represented in a URI fragment identifier by encoding it into octets using UTF-8 [RFC3629], while percent-encoding those characters not allowed by the fragment rule in [RFC3986].

JSONポインターは、UTF-8 [RFC3629]を使用してオクテットにエンコードすることにより、URIフラグメント識別子で表すことができますが、[RFC3986]のフラグメントルールでは許可されていない文字をパーセントエンコードします。

Note that a given media type needs to specify JSON Pointer as its fragment identifier syntax explicitly (usually, in its registration [RFC6838]). That is, just because a document is JSON does not imply that JSON Pointer can be used as its fragment identifier syntax. In particular, the fragment identifier syntax for application/json is not JSON Pointer.

特定のメディアタイプでは、JSONポインターをフラグメント識別子構文として明示的に指定する必要があることに注意してください(通常、登録では[RFC6838])。つまり、ドキュメントがJSONであるからといって、JSONポインターをフラグメント識別子の構文として使用できるとは限りません。特に、application / jsonのフラグメント識別子構文はJSONポインターではありません。

Given the same example document as above, the following URI fragment identifiers evaluate to the accompanying values:

上記と同じドキュメント例が与えられた場合、次のURIフラグメント識別子は付随する値に評価されます。

    #            // the whole document
    #/foo        ["bar", "baz"]
    #/foo/0      "bar"
    #/           0
    #/a~1b       1
    #/c%25d      2
    #/e%5Ef      3
    #/g%7Ch      4
    #/i%5Cj      5
    #/k%22l      6
    #/%20        7
    #/m~0n       8
        
7. Error Handling
7. エラー処理

In the event of an error condition, evaluation of the JSON Pointer fails to complete.

エラー条件が発生した場合、JSONポインターの評価は完了しません。

Error conditions include, but are not limited to:

エラー条件には以下が含まれますが、これらに限定されません。

o Invalid pointer syntax

o 無効なポインター構文

o A pointer that references a nonexistent value

o 存在しない値を参照するポインタ

This specification does not define how errors are handled. An application of JSON Pointer SHOULD specify the impact and handling of each type of error.

この仕様では、エラーの処理方法は定義されていません。 JSONポインターのアプリケーションは、各タイプのエラーの影響と処理を指定する必要があります(SHOULD)。

For example, some applications might stop pointer processing upon an error, while others may attempt to recover from missing values by inserting default ones.

たとえば、一部のアプリケーションはエラー時にポインター処理を停止する可能性がありますが、他のアプリケーションはデフォルト値を挿入することにより欠損値からの回復を試みる場合があります。

8. Security Considerations
8. セキュリティに関する考慮事項

A given JSON Pointer is not guaranteed to reference an actual JSON value. Therefore, applications using JSON Pointer should anticipate this situation by defining how a pointer that does not resolve ought to be handled.

特定のJSONポインターが実際のJSON値を参照することは保証されていません。したがって、JSONポインターを使用するアプリケーションは、解決されないポインターの処理方法を定義することにより、この状況を予測する必要があります。

Note that JSON pointers can contain the NUL (Unicode U+0000) character. Care is needed not to misinterpret this character in programming languages that use NUL to mark the end of a string.

JSONポインターにはNUL(Unicode U + 0000)文字を含めることができることに注意してください。 NULを使用して文字列の終わりをマークするプログラミング言語では、この文字を誤って解釈しないように注意する必要があります。

9. Acknowledgements
9. 謝辞

The following individuals contributed ideas, feedback, and wording to this specification:

以下の個人は、この仕様にアイデア、フィードバック、および表現を提供しました。

Mike Acar, Carsten Bormann, Tim Bray, Jacob Davies, Martin J. Duerst, Bjoern Hoehrmann, James H. Manger, Drew Perttula, and Julian Reschke.

Mike Acar、Carsten Bormann、Tim Bray、Jacob Davies、Martin J. Duerst、Bjoern Hoehrmann、James H. Manger、Drew Perttula、Julian Reschke。

10. References
10. 参考文献
10.1. Normative References
10.1. 引用文献

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC2119] Bradner、S。、「要件レベルを示すためにRFCで使用するキーワード」、BCP 14、RFC 2119、1997年3月。

[RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 10646", STD 63, RFC 3629, November 2003.

[RFC3629] Yergeau、F。、「UTF-8、ISO 10646の変換フォーマット」、STD 63、RFC 3629、2003年11月。

[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005.

[RFC3986] Berners-Lee、T.、Fielding、R。、およびL. Masinter、「Uniform Resource Identifier(URI):Generic Syntax」、STD 66、RFC 3986、2005年1月。

[RFC4627] Crockford, D., "The application/json Media Type for JavaScript Object Notation (JSON)", RFC 4627, July 2006.

[RFC4627] Crockford、D。、「JavaScript Object Notation(JSON)のアプリケーション/ jsonメディアタイプ」、RFC 4627、2006年7月。

[RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, January 2008.

[RFC5234] Crocker、D。およびP. Overell、「構文仕様の拡張BNF:ABNF」、STD 68、RFC 5234、2008年1月。

10.2. Informative References
10.2. 参考引用

[RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type Specifications and Registration Procedures", BCP 13, RFC 6838, January 2013.

[RFC6838] Freed、N.、Klensin、J。、およびT. Hansen、「メディアタイプの仕様と登録手順」、BCP 13、RFC 6838、2013年1月。

Authors' Addresses

著者のアドレス

Paul C. Bryan (editor) Salesforce.com

Paul C. Bryan(編集者)Salesforce.com

   Phone: +1 604 783 1481
   EMail: pbryan@anode.ca
        

Kris Zyp SitePen (USA)

クリスジップサイトペン(米国)

   Phone: +1 650 968 8787
   EMail: kris@sitepen.com
        

Mark Nottingham (editor) Akamai

マーク・ノッティンガム(編集者)アカマイ

   EMail: mnot@mnot.net