3. Syntax
3. Syntax
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.
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.
The ABNF syntax of a JSON Pointer is:
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).
Note that JSON Pointers are specified in characters, not as bytes.