jsonpointer
Get and set nested JSON values using RFC 6901 JSON Pointer path strings
Repository Health
Technical Analysis
jsonpointer is a minimal implementation of RFC 6901 (JSON Pointer) for Node.js, providing get and set functions that resolve slash-delimited path strings like /bar/baz or /qux/0 against a plain JavaScript object or array. Rather than writing manual property-chain traversal or optional-chaining code, callers pass a string path and get back (or write) the value at that location, including support for the - array-append token defined by the spec. A compile(path) helper precompiles a pointer into a reusable object with its own .get/.set methods for repeated lookups against the same path.
What You Get
jsonpointer.get(obj, pointer)to resolve a slash-delimited path string against an object and return the valuejsonpointer.set(obj, pointer, value)to write a value at the location described by a pointer string, including array indices- Support for the RFC 6901
-token to append to the end of an array viaset jsonpointer.compile(pointer)to precompile a path once into an object with boundget/setmethods for repeated use- Bundled TypeScript type declarations (
jsonpointer.d.ts)
Common Use Cases
- Applying JSON Patch (RFC 6902) operations, which reference target locations using JSON Pointer strings
- Resolving
$ref-style or config-driven paths into nested application state or JSON Schema documents without writing custom traversal code - Reading or updating a specific field deep inside a large JSON API response or config object by path string rather than bracket/dot chains
- Building generic diff, patch, or form-binding utilities that need to address arbitrary nested locations in a JSON document
Under The Hood
Architecture
The entire implementation is one file (jsonpointer.js, ~2.5KB) built around a single parse helper that splits a pointer string on / and unescapes ~1/~0 tokens, with get/set walking the resulting token array through the target object one property at a time, and compile caching a parsed token array behind an object exposing bound get/set closures.
Tech Stack
Plain CommonJS JavaScript with no runtime dependencies, hand-written TypeScript declarations (jsonpointer.d.ts) shipped alongside the implementation, standard for linting and a plain test.js (no test framework) run via node test.js, plus semantic-release for publishing.
Code Quality
test.js exercises get/set against nested objects and arrays including the RFC’s - append token and ~0/~1 escaping edge cases, the module has no external dependencies to introduce vulnerabilities, and the code has been stable enough that the last functional release was in 2022 with only maintenance pushes since.
API Design The API surface is deliberately tiny — get(obj, pointer), set(obj, pointer, value), and compile(pointer) — mirroring the RFC’s own terminology so anyone who has read RFC 6901 can use the library immediately, and the README’s five-line example covers every common case (nested object, array index, undefined lookup, array append).
Used by 3 apps in this directory
APITable
Low Code Platforms · Databases
API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.
Flowise
Developer Tools · Automation · No Code Platforms
Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.
Scalar
Developer Tools
Beautiful, interactive OpenAPI documentation with a built-in offline-first API client and multi-language code generation — all in one open-source platform.