JSON Pointer, RFC 6901, is a small specification: four pages, one syntax,
no ambiguity about what a path means. It shows up wherever something needs
to reference one exact location inside a JSON document without inventing
its own path language, most often inside JSON Patch and JSON Schema’s $ref
keyword.
The syntax, briefly
A pointer is a sequence of / separated tokens. /user/name means the
name key inside the user object. /items/0 means the first element of
the items array. The empty string, a pointer with no tokens at all, means
the whole document. Two characters need escaping inside a token: ~1
stands for a literal /, and ~0 stands for a literal ~, always read in
that order so ~01 means ~1 rather than /.
Using the JSON Pointer evaluator
Paste a document, type a pointer, and press Resolve. Given
{"a/b":{"c~d":42},"list":["x","y"]}
the pointer /a~1b/c~0d resolves through a key that literally contains a
slash and a key that literally contains a tilde, returning 42. That is
the whole reason the escapes exist: without them, a key containing the
separator character would be impossible to address.
What a failed lookup tells you
Most tools report a failed pointer as a bare “not found,” which is not
enough to fix it in a document with more than a handful of keys. This one
tells you how far the pointer got, what it found there, and which keys the
object actually has. Asking for /a~1b/nope against the same document
returns:
No key “nope” in the object here, it has c
d. Resolved as far as /a1b
That is enough to see the typo immediately, rather than re-reading the whole document to guess what went wrong.
The dash, and why it does not resolve
Inside JSON Patch, a dash as the last token of a pointer into an array
means “the position after the last element,” used for appending. On its
own, resolving /items/- against a document does not name an existing
value, because there is nothing there yet to point at. The evaluator
explains this distinction rather than treating it as a generic parse
failure.
Where this differs from JSONPath
JSON Pointer names one location and resolves to exactly one value or fails. JSONPath is a query language that can match many values at once, with wildcards, filters and slices. Reach for a pointer when you already know exactly which value you want; reach for JSONPath when you are searching for values that match a condition.