Decode a URI fragment
05A URI fragment can carry a percent-encoded JSON Pointer only when its media type explicitly defines that interpretation.
The token c%d selects the exact member with that name. Percent encoding does not change the object member itself.
Source for this drawing: RFC 6901 · Read RFC section 6 ↗
New to this? Start hereA quick picture + helpful background
A message needs an address.
Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Terms in this drawing
- URI fragment
- The part following # in a URI; its interpretation depends on the media type.
- Percent encoding
- A percent sign followed by two hexadecimal digits representing one octet.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
A JSON document does not automatically make its URI fragment a pointer.
- To represent a pointer in a URI fragment, encode it into UTF-8 octets and percent-encode the characters not allowed by the URI fragment syntax.
- The media type needs to specify JSON Pointer as its fragment identifier syntax explicitly. In particular, application/json does not by itself define JSON Pointer fragment semantics.
- When interpreting a supported fragment representation, recover the pointer from the percent-encoded fragment before evaluating its tokens. For example, #/c%25d carries /c%d, which selects the object member c%d. The # is the fragment delimiter, not part of the pointer string.
The example document has a member c%d with value 2, and assumes a media type that explicitly supports JSON Pointer fragments. The empty fragment # identifies the root under that assumption; #/ instead addresses an empty-name object member. Pointer ~0/~1 escaping still applies after the representation layer is decoded.
Read the RFC section ↗