JSON Pointer

Input
Output

JSON Pointer Tester

JSON Pointer (RFC 6901) addresses one value with a path like /items/0/sku. It is used by JSON Patch and by $ref in JSON Schema. Get a value, or list the pointer of every value in your document.

Example: a path inside an OpenAPI document

OpenAPI paths contain slashes, so in a pointer each / inside a key is written ~1 (and each ~ as ~0). This pointer reaches the summary of GET /users/{id}, the same way a $ref would:

Input

{
  "openapi": "3.1.0",
  "paths": {
    "/users/{id}": {
      "get": {
        "summary": "Get a user",
        "operationId": "getUser"
      }
    }
  }
}

Expression

/paths/~1users~1{id}/get/summary

Output

"Get a user"

How do I use the JSON Pointer?

  1. Paste JSON.
  2. Type a pointer, or choose List every pointer.
  3. Copy the value or the pointers.

What does the JSON Pointer do?

  • Escapes ~0 and ~1 handled
  • List every pointer in a document
  • Works with JSON Patch paths

When to use the JSON Pointer

JSON Pointer (RFC 6901) is the path syntax that JSON Patch, JSON Schema $ref and OpenAPI use to name exactly one value: /items/0/sku means the sku of the first item. Test a pointer here before you put it into a patch or a $ref, or list every pointer in a document to find the one you need.

Each step is a key or an array index, separated by /. A key that contains / is written with ~1 and a key with ~ with ~0, as in the OpenAPI example above. The #/components/schemas/User form used in $ref works too. An empty pointer means the whole document, and a pointer to something that isn't there says so.

Frequently asked questions

How is JSON Pointer different from JSONPath?
A pointer names exactly one value and has no wildcards or filters. JSONPath ($..sku, $.items[?(@.qty > 1)]) can match many values. Patches and $refs use pointers because they must be exact.
How do I point at an array item?
Use its index from 0: /items/2 is the third item. JSON Patch also uses /items/- to mean the end of the array when adding an item.
How is this different from JSONPath?
A JSON Pointer names exactly one value. JSONPath can match many values with filters and wildcards.
Is my data uploaded?
No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.

More JSON tools

Bracely has 108 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram