{ }jsonkitOpen
Querying and transformation

JSON Pointer (RFC 6901)

Also called RFC 6901, JSON Pointer

A JSON Pointer (RFC 6901) is a string that identifies one value in a JSON document, like /users/0/name. Each slash-separated token is an object key or an array index, and a ~ or / inside a key is written as ~0 or ~1. JSON Patch, the $ref keyword and validation errors all use pointers.

In more detail

A JSON Pointer is a string that identifies exactly one value inside a JSON document. RFC 6901 defines it. The empty string points to the whole document, and each /token steps into an object key or an array index.

Two characters need escaping inside a token: ~ is written ~0 and / is written ~1. So the key a/b becomes /a~1b. Array indexes are written in decimal without leading zeros, so /users/0 is valid and /users/01 is not.

In a URI, such as a JSON Schema $ref, the pointer follows a # and is percent-encoded: #/definitions/user or #/a%20b. JSON Patch, JSON Schema error locations and many validation libraries use pointers to say where something is.

A pointer names one location, unlike JSONPath, which is a query that can return many matches.

Example

Resolving pointers against a small documentjson
// Document
{ "users": [ { "name": "Ada", "a/b": 1, "m~n": 2 } ] }

// Pointers and what they resolve to
""                  -> the whole document
"/users/0/name"     -> "Ada"
"/users/0/a~1b"     -> 1
"/users/0/m~0n"     -> 2

Try it

← Back to JSON Pointer (RFC 6901) in the JSON glossaryUpdated 2026-10-01