# JSON pointer get

`json-pointer-get` · version 1.0.0 · JSON & JSONL · free, no key needed

Return the cloned JSON value at an RFC 6901 pointer.

**Use when you need to: json pointer get · get json pointer · read json pointer.**

## Supported

- json pointer get
- get json pointer
- read json pointer

## Not supported

- json patch
- create missing
- prototype walk
- fetch

## Behavior

- Accept only JSON values: null, boolean, finite number, string, array, and plain objects.
- Reject NaN, Infinity, -Infinity, undefined, BigInt, functions, symbols, Date, Map, Set, RegExp, boxed primitives, Buffer, and sparse holes.
- Canonicalize -0 to 0.
- Objects may have null or Object.prototype; use own enumerable string keys only.
- Treat __proto__, constructor, and toString as ordinary own keys. Never mutate Object.prototype.
- Output objects must be Object.create(null). Deep-clone all returned JSON values.
- Bound walk: max depth 32, max nodes 10000, max UTF-8 JSON bytes 250KiB of the input document string if provided as text; when json is already a value, bound the walked node count and depth.
- pointer is RFC 6901. Empty pointer returns a clone of the whole value.
- Tokens: split on /, reject pointer not empty and not starting with /.
- ~0 decodes to ~ and ~1 to /. A ~ not followed by 0 or 1 is invalid.
- On objects, use Object.hasOwn only. Array tokens must be "0" or [1-9][0-9]* with no leading zeros. "-" is not an existing index.
- Missing path, out-of-range index, or indexing a primitive is invalid_input.

## Input

- `json` (any JSON value, required)
- `pointer` (string, required): max length 1024

## Output

- `value` (any JSON value, required)

## Limits

- max json depth: 32
- max json nodes: 10000
- max pointer chars: 1024

## Example

Request input:

```json
{
  "json": {
    "a": [
      {
        "b": 1
      }
    ]
  },
  "pointer": "/a/0/b"
}
```

Response:

```json
{
  "result": {
    "value": 1
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "json-pointer-get",
  "version": "1.0.0",
  "input": {
    "json": {
      "a": [
        {
          "b": 1
        }
      ]
    },
    "pointer": "/a/0/b"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/json-pointer-get/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"json":{"a":[{"b":1}]},"pointer":"/a/0/b"}'
```

The machine-readable contract is at [/v1/tools/json-pointer-get/versions/1.0.0](/v1/tools/json-pointer-get/versions/1.0.0).

### CLI

```sh
node cli.mjs run json-pointer-get 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [JSON flatten](/tools/json-flatten): Flatten a JSON value into a null-prototype map keyed by RFC 6901 JSON Pointers.
- [JSON pointer has](/tools/json-pointer-has): Return whether an RFC 6901 pointer exists as an own path.
- [JSON pointer list](/tools/json-pointer-list): List RFC 6901 pointers to every reachable JSON node, root first.
- [JSON unflatten](/tools/json-unflatten): Reconstruct a JSON value from a map of RFC 6901 JSON Pointers to leaves.
- [Array to JSONL](/tools/array-to-jsonl): Serialize an array of JSON-safe values as JSON Lines text.
- [JSON array anti join](/tools/json-array-anti-join): Anti join two JSON arrays of objects on exact keys.
