Data Formats & Debugging · Field note
JSONPath vs JSON Pointer: selecting values vs addressing exact locations
Understand when you need a query language like JSONPath and when you need an exact address like JSON Pointer.

Before you start
Lint or format before comparing data, then check that cleanup did not change the fields, order, or values that matter.
JSONPath and JSON Pointer look related because both are strings that “point into JSON.” They solve different jobs. Confusing them is why queries return nothing or patches target impossible paths.
The quick distinction is this: JSONPath selects matching values; JSON Pointer names one exact location.
In brief
What it is: JSONPath is a query language for selecting JSON values, while JSON Pointer is an exact path syntax for one specific location in a JSON document.
Why it matters: Using the right syntax for the right job makes querying, patching, and validation much easier to reason about.
Watch for: A JSONPath expression that can match many values is not a legal JSON Pointer target for operations that require one exact address.
Selection vs addressing
JSONPath is for asking questions like “which prices under this tree are greater than 10?” JSON Pointer is for saying “the value at this exact path.” Those are fundamentally different intentions. The first is query-like and can yield many results. The second is address-like and should resolve to at most one location.
Once you frame them that way, the syntax differences stop feeling arbitrary.
Why patching wants pointers, not queries
JSON Patch needs an exact target because it is mutating a document. A query that returns many nodes is not enough. That is why JSON Patch is built on JSON Pointer, not JSONPath. Trying to stuff one into the other is a sign the workflow question was never clarified.
- Use JSONPath to find matching values.
- Use JSON Pointer to name one exact location.
- Use JSON Pointer in patch operations and exact structural references.
A cleaner tool split
JSONPath and JSON Pointer should stay separate in your mental model. They solve related but different lookup problems, and combining them too casually hides important failure modes.
See it in a small example
Notice: If the operation updates data, you usually need an exact address, not a query expression.
JSONPath -> find all matching values
JSON Pointer -> address one exact value
What to verify
- Ask whether you need many matches or one exact target.
- Choose JSON Pointer when the next step mutates or validates one location.
- Choose JSONPath when you are extracting or filtering values.
Common questions
Can JSONPath replace JSON Pointer?
No. It is a more expressive selection language, not a one-to-one replacement for exact addresses.
Can JSON Pointer return many values?
No. It resolves to at most one location.