JSON path reference

JSON Pointer vs JSONPath

JSON Pointer and JSONPath both identify data inside JSON, but they solve different problems. JSON Pointer is a compact standard for identifying one exact location. JSONPath is a query language used to select one or many matching values.

Quick answer

Use JSON Pointer when you need a stable exact path such as /users/0/email. Use JSONPath when you need selection logic such as $.users[*].email.

JSON Pointer is exact

JSON Pointer is standardized by RFC 6901. A pointer starts at the document root and follows slash-separated reference tokens. Arrays use numeric indexes. The characters ~ and / are escaped as ~0 and ~1 inside tokens.

JSONPath is a query

JSONPath typically starts with $ for the root and supports property access, array indexes, wildcards and—depending on the implementation—recursive descent, filters and slices. Because implementations differ, test advanced expressions against the library used by your application.

Choosing between them

Choose Pointer for JSON Patch operations, exact references, API error paths and stable machine-readable locations. Choose JSONPath for searching, extraction, testing and analytics when one expression may match multiple nodes.

Same target, different syntax

JSON Pointer: /users/0/email
JSONPath:     $.users[0].email

All user emails:
JSONPath:     $.users[*].email

Related JSON tools and guides

Frequently asked questions

Is JSON Pointer standardized?

Yes. JSON Pointer is defined by RFC 6901.

Is JSONPath standardized?

JSONPath has an IETF standard now, but library support and advanced feature behavior can still vary by implementation.

Can JSON Pointer select multiple values?

A JSON Pointer identifies a single location. For query-style multi-value selection, JSONPath is usually the better fit.