Home → JSON Pointer RFC 6901 Online

JSON Pointer RFC 6901 Online

Resolve JSON Pointer expressions to navigate to any value in a JSON document.

About This Tool

Resolve JSON Pointer expressions to navigate to any value in a JSON document. This tool runs entirely in your browser — no data is ever sent to a server. Free to use, no account required.

What JSON Pointer Is (RFC 6901)

JSON Pointer is a string syntax for precisely identifying a single value within a JSON document, defined in RFC 6901.

JSON Pointer Syntax

A pointer starts with / and each segment separated by / refers to an object key or array index. The empty string "" refers to the whole document. For example: /users/0/email points to the email key of the first user object.

Escaping Special Characters

Two characters need escaping: forward slash / becomes ~1, and tilde ~ becomes ~0. This allows any key name to be expressed as a JSON Pointer regardless of its content.

JSON Pointer vs JSONPath

Both JSON Pointer and JSONPath navigate JSON documents, but they have fundamentally different capabilities and use cases.

When to Use JSON Pointer

JSON Pointer is the right choice for precise, unambiguous reference to exactly one value. It is used in JSON Patch (RFC 6902) for specifying operation targets and in JSON Schema for $ref references.

When to Use JSONPath

JSONPath is more powerful: it supports wildcards, filters, recursive descent, and can return multiple matching values. Use JSONPath for queries and data extraction tasks; use JSON Pointer for exact single-value addressing.

Frequently Asked Questions

What is a JSON Pointer?+
A JSON Pointer (RFC 6901) is a string that identifies a specific location within a JSON document. It uses forward slashes to separate path segments, where each segment is either an object key or an array index. For example, /user/0/name points to the name key of the first element of the user array.
How do I reference an array element with a JSON Pointer?+
Use the zero-based index as the path segment. For example, /items/0 refers to the first element of the items array, /items/2 to the third element. To reference the position after the last element (for appending in JSON Patch add operations), use the special index '-'.
What if my JSON key contains a forward slash?+
Forward slashes in key names are escaped as ~1 in JSON Pointer syntax. Tilde characters are escaped as ~0. So a key named 'a/b' is referenced as a~1b in the pointer path. This escaping scheme ensures all key names can be represented unambiguously.
What is the difference between JSON Pointer and JSONPath?+
JSON Pointer always identifies exactly one value using a simple slash-separated syntax (RFC 6901). JSONPath is a richer query language that can match multiple values using wildcards, filters, and recursive descent. Use JSON Pointer for precise single-value references; use JSONPath for flexible queries returning multiple results.

JSON Pointer Syntax and Examples

JSON Pointer (RFC 6901) is a string syntax for identifying specific values within a JSON document. It's used by JSON Patch, OpenAPI $ref, and many query libraries.

JSON Pointer Reference Table

// JSON Document
{
  "store": {
    "book": [
      {"title": "JSON Basics", "price": 9.99},
      {"title": "Advanced Go", "price": 14.99}
    ],
    "name": "Tech Books"
  },
  "version": 2
}

// Pointer Examples
""          → entire document
"/version"  → 2
"/store/name" → "Tech Books"
"/store/book/0" → {"title":"JSON Basics","price":9.99}
"/store/book/1/title" → "Advanced Go"
"/store/book/-"  → (append to array in Patch operations)

JSON Pointer Escape Sequences

EscapeMeaning
~0Literal tilde character (~)
~1Literal forward slash (/)
None neededAll other characters used as-is

JSON Pointer in JavaScript

// Evaluate JSON Pointer manually
function getByPointer(obj, pointer) {
  if (pointer === "") return obj;
  return pointer.slice(1).split("/").reduce((cur, key) => {
    key = key.replace(/~1/g, "/").replace(/~0/g, "~");
    return cur[key];
  }, obj);
}

getByPointer(doc, "/store/book/0/title"); // "JSON Basics"

// npm: json-pointer library
const jp = require("json-pointer");
jp.get(doc, "/store/book/1/price"); // 14.99

JSON Pointer Syntax Reference

Every JSON Pointer is either an empty string (pointing to the root document) or a sequence of /-prefixed reference tokens. Special characters ~ and / inside key names must be escaped.

Pointer Points To Notes
(empty string)Entire documentRoot reference
/nameTop-level "name" keyMust start with /
/address/cityNested propertyEach / is a level
/items/0First array elementArrays use 0-based index
/items/2Third array element
/items/-Element after lastUsed in JSON Patch "add"
/a~0bKey named "a~b"~ escapes ~ as ~0, / as ~1
/m~1nKey named "m/n"Forward slash escaped as ~1
// JSON Pointer evaluation (RFC 6901)
const doc = {
  "foo": ["bar", "baz"],
  "": 0,
  "a/b": 1,
  "c%d": 2
};

// Pointer  → Value
// ""       → entire document
// "/foo"   → ["bar","baz"]
// "/foo/0" → "bar"
// "/foo/1" → "baz"
// "/"      → 0  (empty string key)
// "/a~1b"  → 1  (key "a/b", / escaped as ~1)

JSON Pointer vs JSONPath

JSON Pointer and JSONPath both navigate JSON documents but serve different purposes. Pointer identifies a single location; JSONPath queries multiple values with wildcards and filters.

Feature JSON Pointer (RFC 6901) JSONPath
Syntax/key/subkey/0$.key.subkey[0]
Multiple matchesNo — always one valueYes — wildcards and filters
WildcardsNoYes ([*], ..)
Filter expressionsNoYes ([?(@.x > 0)])
StandardIETF RFC 6901RFC 9535
Used byJSON Patch, JSON Schema, APIsData extraction, querying
Best forPrecise single-value accessQuerying multiple values

Explore more tools: All JSON Tools | Validator | Pretty Print | JSON Diff