Visual RFC.
ALL RFCs / RFC 6901
Read the RFC ↗
RFC 6901 / JSON POINTER

Select an array element

03

An array interprets a token as a zero-based index, with strict rules for its spelling and bounds.

RFC 6901 · § 4EXAMPLE
3 / 3
Select an array elementThe items member selects an array A, B, C. Token 1 selects zero-based position one, yielding B. The alternative array tokens 01, dash and 3 fail to resolve this array.An array gives the token a different meaningWorked example: {"items":["A","B","C"]}Pointer: /items/1"A"index 0"B"index 1"C"index 2token 1Result: "B"Array alternatives: 01, -, 3 → no elementA missing element is not created by a pointer
03
Return the existing value.

The result is B. The alternative array tokens 01, - and 3 do not resolve elements of this three-item array.

Source for this drawing: RFC 6901 · Read RFC section 4 ↗

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
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
Zero-based index
A position count beginning with 0 for the first element.
Scalar
A non-container JSON value such as a string, number, boolean or null.
Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

KEY POINT

Interpret each token using the type of the current value.

  • An array index is 0 or an unsigned base-10 integer without a leading zero. Index 0 selects the first element; the array token MUST follow the index rules or be the single character -.
  • The - token denotes the nonexistent position after the final element. It always fails to resolve a concrete array value under JSON Pointer alone; an application must separately define useful handling for it.
  • Invalid indices, out-of-range indices, nonexistent object members and attempts to descend through a scalar cannot resolve a concrete value. Evaluation fails; any recovery or mutation behavior belongs to the application, not to JSON Pointer itself.
DETAILS

The example is {"items":["A","B","C"]}, so /items/1 selects B. The spelling 01 can be an object member name, but not an array index. A pointer is not guaranteed to exist, and resolving one is not an authorization check.

Read the RFC section ↗

All chapters in RFC 6901

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗