
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
@swagger-api/apidom-json-pointer
Advanced tools
apidom-json-pointer is a package that evaluates JSON Pointer against ApiDOM.
You can install this package via npm CLI by running the following command:
$ npm install @swagger-api/apidom-json-pointer
This is the recommended API for use in new projects. It is fully compliant with RFC 6901 and supports all aspects of JSON Pointer.
Uses @swaggerexpert/json-pointer under the hood and fully reflects its API. For additional options and details, refer to the @swaggerexpert/json-pointer documentation.
Evaluation is contextual to ApiDOM realm - meaning evaluate function
expects only ApiDOM as the first argument.
import { evaluate } from '@swagger-api/apidom-json-pointer/modern';
import { ObjectElement } from '@swagger-api/apidom-core';
import { evaluate } from '@swagger-api/apidom-json-pointer/modern';
const apidom = new ObjectElement({ a: { b: 'c' } });
const result = evaluate(apidom, '/a/b');
// => StringElement('c')
Parses JSON Pointer into a list of tokens, which can be accessed through the tree property of the parse result.
import { parse } from '@swagger-api/apidom-json-pointer/modern';
const parseResult = parse('/a/b');
// =>
// {
// result: {
// success: true,
// state: 101,
// stateName: 'MATCH',
// length: 4,
// matched: 4,
// maxMatched: 4,
// maxTreeDepth: 8,
// nodeHits: 31
// },
// tree: [ 'a', 'b' ],
// stats: undefined,
// trace: undefined
// }
Compiles a list of tokens into JSON Pointer.
import { compile } from '@swagger-api/apidom-json-pointer/modern';
const jsonPointer = compile(['a', 'b']); // => '/a/b'
Escapes/unescapes tokens of JSON Pointer.
import { escape, unescape } from '@swagger-api/apidom-json-pointer/modern';
escape('~a/'); // => '~0a~1'
unescape('~0a~1'); // => '~a/'
Handles case of URI Fragment Identifier Representation.
import { URIFragmentIdentifier } from '@swagger-api/apidom-json-pointer/modern';
URIFragmentIdentifier.fromURIReference('https://example.com/path/#/a/b'); // => '/a/b'
Validates a JSON Pointer and its tokens.
import {
testJSONPointer,
testReferenceToken,
testArrayLocation,
testArrayIndex,
testArrayDash,
} from '@swagger-api/apidom-json-pointer/modern';
testJSONPointer('/a/b'); // => true
testReferenceToken('a'); // => true
testArrayLocation('0'); // => true
testArrayLocation('-'); // => true
testArrayIndex('0'); // => true
testArrayDash('-'); // => true
JSONPointerError is the base class for all JSON Pointer errors.
import { JSONPointerError } from '@swagger-api/apidom-json-pointer/modern';
If an invalid list of tokens is supplied to compile function, JSONPointerCompileError is thrown.
import { JSONPointerCompileError } from '@swagger-api/apidom-json-pointer/modern';
If an invalid JSON Pointer is supplied to evaluate function, JSONPointerEvaluateError is thrown.
import { JSONPointerEvaluateError } from '@swagger-api/apidom-json-pointer/modern';
If a valid JSON Pointer is supplied to evaluate function and the pointer cannot be evaluated against ApiDOM fragment because it is not an object or an array, JSONPointerTypeError is thrown.
import { JSONPointerTypeError } from '@swagger-api/apidom-json-pointer/modern';
If a valid JSON Pointer is supplied to evaluate function and the pointer cannot be evaluated against ApiDOM fragment because the key does not exist in the object, JSONPointerKeyError is thrown.
import { JSONPointerKeyError } from '@swagger-api/apidom-json-pointer/modern';
If a valid JSON Pointer is supplied to evaluate function and the pointer cannot be evaluated against ApiDOM fragment because the index does not exist in the array, JSONPointerIndexError is thrown.
import { JSONPointerIndexError } from '@swagger-api/apidom-json-pointer/modern';
If an error occurs in parse function, JSONPointerParseError is thrown.
import { JSONPointerParseError } from '@swagger-api/apidom-json-pointer/modern';
This is a legacy API not recommended for use in new projects. It is provided for backward compatibility only. The legacy API implementation is not RFC 6901 compliant, nor does it support all features of JSON Pointer.
Importing legacy API from @swagger-api/apidom-json-pointer is equivalent to importing from @swagger-api/apidom-json-pointer/legacy.
import { evaluate } from '@swagger-api/apidom-json-pointer';
or
import { evaluate } from '@swagger-api/apidom-json-pointer/legacy';
import { ObjectElement } from '@swagger-api/apidom-core';
import { evaluate } from '@swagger-api/apidom-json-pointer';
const apidom = new ObjectElement({ a: { b: 'c' } });
const result = evaluate('/a/b', apidom);
// => StringElement('c')
Parses JSON Pointer into a list of tokens.
import { parse } from '@swagger-api/apidom-json-pointer';
const tokens = parse('/a/b'); // => ['a', 'b']
Compiles a list of tokens into JSON Pointer.
import { compile } from '@swagger-api/apidom-json-pointer';
const jsonPointer = compile(['a', 'b']); // => '/a/b'
Escapes/unescapes tokens of JSON Pointer.
import { escape, unescape } from '@swagger-api/apidom-json-pointer';
escape('~a/'); // => '~0a~1'
unescape('~0a~1'); // => '~a/'
Handles case of URI Fragment Identifier Representation.
import { uriToPointer } from '@swagger-api/apidom-json-pointer';
uriToPointer('https://example.com/path/#/a/b'); // => '/a/b'
If an invalid JSON Pointer is supplied to parse or evaluate functions, InvalidJsonPointerError
is thrown.
import { InvalidJsonPointerError } from '@swagger-api/apidom-json-pointer';
If a valid JSON Pointer is supplied to evaluate function and the pointer cannot be evaluated against
ApiDOM fragment, EvaluationJsonPointerError is thrown.
import { EvaluationJsonPointerError } from '@swagger-api/apidom-json-pointer';
The 'jsonpointer' package provides similar functionality for working with JSON Pointers. It allows you to get and set values in JSON documents using JSON Pointers. Compared to @swagger-api/apidom-json-pointer, 'jsonpointer' is more widely used and has a simpler API.
The 'json-ptr' package is another alternative for working with JSON Pointers. It offers a comprehensive set of features for creating, resolving, and manipulating JSON Pointers. It also includes additional utilities for working with JSON References. 'json-ptr' is more feature-rich compared to @swagger-api/apidom-json-pointer.
FAQs
Evaluate JSON Pointer expressions against ApiDOM.
The npm package @swagger-api/apidom-json-pointer receives a total of 180,182 weekly downloads. As such, @swagger-api/apidom-json-pointer popularity was classified as popular.
We found that @swagger-api/apidom-json-pointer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.