# @jsonjoy.com/json-pointer

> High-performance JSON Pointer implementation

Latest version **18.30.0** (published 2026-09-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @jsonjoy.com/json-pointer
pnpm add @jsonjoy.com/json-pointer
yarn add @jsonjoy.com/json-pointer
bun add @jsonjoy.com/json-pointer
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 18.30.0 |
| Published | 2026-09-08 |
| First published | 2024-10-05 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.0 |
| Dependencies | 1 |
| Unpacked size | 153.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1092 |
| Author | streamich |
| Maintainers | json-joy-team, streamich |
| Keywords | json-pointer, json, pointer, jit, selector, pick |

## Links

- npm: https://www.npmjs.com/package/@jsonjoy.com/json-pointer
- Repository: https://github.com/streamich/json-joy
- Homepage: https://github.com/streamich/json-joy/packages/json-pointer
- Issues: https://github.com/streamich/json-joy/issues
- Funding: https://github.com/sponsors/streamich
- npm.io page: https://npm.io/package/@jsonjoy.com/json-pointer

## Dependencies (1)

- [@jsonjoy.com/util](https://npm.io/package/@jsonjoy.com/util.md) 18.30.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 18.30.0 (latest) — 2026-09-08
- 18.28.0 — 2026-06-02
- 18.24.0 — 2026-05-15
- 18.23.0 — 2026-05-14
- 18.22.0 — 2026-05-14
- 18.21.0 — 2026-05-10
- 18.20.0 — 2026-05-09
- 18.19.0 — 2026-05-07
- 18.18.0 — 2026-05-07
- 18.17.0 — 2026-05-07
- 18.16.0 — 2026-05-06
- 18.15.0 — 2026-04-18
- 18.14.0 — 2026-04-16
- 18.13.0 — 2026-04-15
- 18.12.0 — 2026-04-12
- … 21 more at https://npm.io/package/@jsonjoy.com/json-pointer/versions

## README

# JSON Pointer - `json-pointer`

Fast implementation of [JSON Pointer (RFC 6901)][json-pointer]
specification in TypeScript.

[json-pointer]: https://tools.ietf.org/html/rfc6901


## Usage

Can find a value in a JSON object using three methods: (1) JSON Pointer string,
(2) array of steps, or (3) a pre-compiled function.


## Examples

Find the value in a JSON document at some specific location.


### Find by JSON Pointer string

```js
import { findByPointer } from '@jsonjoy.com/json-pointer';

const doc = {
  foo: {
    bar: 123,
  },
};

const res = findByPointer(doc, '/foo/bar');
```


### Find by path array

Alternatively, you can specify an array of steps, such as `['foo', 'bar']`. Or,
use the `parseJsonPointer` function to convert a JSON Pointer string to an array.

```js
import { find, parseJsonPointer } from '@jsonjoy.com/json-pointer';

const doc = {
  foo: {
    bar: 123,
  },
};

const path = parseJsonPointer('/foo/bar');
const ref = find(doc, path);

console.log(ref);
// { val: 123, obj: { bar: 123 }, key: 'bar' }
```


### Pre-compiled function

If you know the path in advance, you can compile a function that will find the
value at that location, it will work few times faster than the previous methods.

```js
import { $$find } from '@jsonjoy.com/json-pointer/lib/codegen';

const doc = {
  foo: {
    bar: 123,
  },
};
const finder = $$find(['foo', 'bar']);

const res = finder(doc);
```


## Low-level API

Convert JSON Pointer to path array and back.

```js
import { parseJsonPointer } from '@jsonjoy.com/json-pointer';

console.log(parseJsonPointer('/f~0o~1o/bar/1/baz'));
// [ 'f~o/o', 'bar', '1', 'baz' ]

console.log(formatJsonPointer(['f~o/o', 'bar', '1', 'baz']));
// /f~0o~1o/bar/1/baz
```

Decode and encode a single step of JSON Pointer.

```js
console.log(unescapeComponent('~0~1'));
// ~/

console.log(escapeComponent('~/'));
// ~0~1
```

---
_Source: https://npm.io/package/@jsonjoy.com/json-pointer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
