
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
@jsonjoy.com/json-pointer
Advanced tools
json-pointerFast implementation of JSON Pointer (RFC 6901) specification in TypeScript.
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.
Find the value in a JSON document at some specific location.
import { findByPointer } from '@jsonjoy.com/json-pointer';
const doc = {
foo: {
bar: 123,
},
};
const res = findByPointer(doc, '/foo/bar');
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.
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' }
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.
import { $$find } from '@jsonjoy.com/json-pointer/lib/codegen';
const doc = {
foo: {
bar: 123,
},
};
const finder = $$find(['foo', 'bar']);
const res = finder(doc);
Convert JSON Pointer to path array and back.
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.
console.log(unescapeComponent('~0~1'));
// ~/
console.log(escapeComponent('~/'));
// ~0~1
FAQs
High-performance JSON Pointer implementation
The npm package @jsonjoy.com/json-pointer receives a total of 13,611,547 weekly downloads. As such, @jsonjoy.com/json-pointer popularity was classified as popular.
We found that @jsonjoy.com/json-pointer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.