Internet Engineering Task Force                            P. Bryan, Ed.
Internet-Draft                                        ForgeRock US, Inc.
Intended status: Informational                                    K. Zyp
Expires: December 11, 2011                                 SitePen (USA)
                                                            June 9, 2011


                              JSON Pointer
                    draft-pbryan-zyp-json-pointer-00

Abstract

   JSON Pointer provides a syntax for identifying a specific node within
   a JSON document.

Status of this Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on December 11, 2011.

Copyright Notice

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

   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.





Bryan & Zyp             Expires December 11, 2011               [Page 1]


Internet-Draft                JSON Pointer                     June 2011


Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . 3
   2.  Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 3
   3.  Syntax  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
   4.  Evaluation  . . . . . . . . . . . . . . . . . . . . . . . . . . 3
   5.  Error Handling  . . . . . . . . . . . . . . . . . . . . . . . . 4
   6.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . 4
   7.  IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 4
   8.  Security Considerations . . . . . . . . . . . . . . . . . . . . 4
   9.  References  . . . . . . . . . . . . . . . . . . . . . . . . . . 4
     9.1.  Normative References  . . . . . . . . . . . . . . . . . . . 4
     9.2.  Informative References  . . . . . . . . . . . . . . . . . . 4
   Appendix A.  Examples . . . . . . . . . . . . . . . . . . . . . . . 5
   Appendix B.  Changelog  . . . . . . . . . . . . . . . . . . . . . . 5
   Appendix C.  Open Issues  . . . . . . . . . . . . . . . . . . . . . 5
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . . . 5


































Bryan & Zyp             Expires December 11, 2011               [Page 2]


Internet-Draft                JSON Pointer                     June 2011


1.  Introduction

   This Internet-Draft proposes JSON Pointer, a syntax for identifying a
   specific node within a JSON [RFC4627] document.  The syntax is
   intended to be expressed in a JSON string value or in a URL fragment
   identifier for a resource with a JSON representation.


2.  Conventions

   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].


3.  Syntax

   A JSON Pointer is a sequence of zero or more property reference
   tokens, starting with and separated by the "/" (\x2F) character.
   Each property reference token is a sequence of unreserved characters
   or escape sequences per [RFC2396].

   pointer = "/" 0*1( token *( "/" token ) )
   token = 1*<URI unreserved character or escape sequence>

   It is an error condition if a JSON Pointer does not conform to this
   syntax.


4.  Evaluation

   A JSON Pointer is evaluated against a target JSON document and yields
   a target node.  Evaluation begins with the initial target node being
   the JSON document itself.  For each property reference token, a new
   target node is selected from the current target node.

   If the current target node is a JSON object, then the new target is
   the value of the property with the name identified by the next
   property reference token.  If the current target node is a JSON
   array, then the new target is the value of the item in the array with
   the zero-based index identified by the next property reference token
   (which MUST be a non-negative integer number value).

   It is an error condition if a property reference token fails to
   resolve a value for the current target node.  The target node is
   successively updated for each property reference token until the
   entire sequence of property reference tokens is evaluated.




Bryan & Zyp             Expires December 11, 2011               [Page 3]


Internet-Draft                JSON Pointer                     June 2011


   Property names SHOULD be URI encoded per [RFC2396].  In particular,
   any "/" character in a property name MUST be encoded as "%2F" to
   avoid being interpreted as a property reference token separator.


5.  Error Handling

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


6.  Acknowledgements

   This specification originated from the [JSON Schema] specification.


7.  IANA Considerations

   This draft includes no request to IANA.


8.  Security Considerations

   This draft includes no security considerations.


9.  References

9.1.  Normative References

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

   [RFC2396]  Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
              Resource Identifiers (URI): Generic Syntax", RFC 2396,
              August 1998.

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

9.2.  Informative References

   [JSON Schema]
              Zyp, K. and G. Court, "A JSON Media Type for Describing
              the Structure and Meaning of JSON Documents",
              November 2010,
              <http://tools.ietf.org/html/draft-zyp-json-schema-03>.




Bryan & Zyp             Expires December 11, 2011               [Page 4]


Internet-Draft                JSON Pointer                     June 2011


Appendix A.  Examples

   For example, for the following JSON representation:

   {
       "foo": {
           "anArray": [
               { "prop": 44 }
           ],
           "another prop": {
               "baz": "A string"
           }
       }
   }

   The following JSON Pointers would be resolved:

   JSON Pointer             resolution
   -------------------      ----------
   /                        self, the root of the resource itself
   /foo                     the object referred to by the foo property
   /foo/another%20prop      the object referred to by the "another prop"
                            property of the object referred to by the
                            "foo" property
   /foo/another%20prop/baz  the string referred to by the value of "baz"
                            property of the "another prop" property of
                            the object referred to by the "foo" property
   /foo/anArray/0           the first object in the "anArray" array


Appendix B.  Changelog

   draft-00

         Initial draft.


Appendix C.  Open Issues

   TBD











Bryan & Zyp             Expires December 11, 2011               [Page 5]


Internet-Draft                JSON Pointer                     June 2011


Authors' Addresses

   Paul C. Bryan (editor)
   ForgeRock US, Inc.
   201 NE Park Plaza Drive Suite 196
   Vancouver, WA  98684
   USA

   Phone: +1 604 783 1481
   Email: paul.bryan@forgerock.com


   Kris Zyp
   SitePen (USA)
   530 Lytton Avenue
   Palo Alto, CA  94301
   USA

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































Bryan & Zyp             Expires December 11, 2011               [Page 6]