Skip to main content
JavaScript & Node.js JSON Engine

JavaScript JSONPath Evaluator & Tester

Execute, debug, and test JSONPath expressions in real time. Inspect recursive descents ($..), filter predicates (?(@.price < 10)), array slices, and generate equivalent native JavaScript ES6 code.

Preset Queries:
Source JSON Document
Evaluation Result

JSONPath Syntax Reference Cheat Sheet

Common operators and tokens defined by Stefan Goessner's JSONPath specification:

Operator Meaning Example
$ The root object or element $
@ The current item being processed in filter predicates [?(@.price > 10)]
. or [] Child member operator $.store.book or $['store']['book']
.. Recursive descent (searches all descendant objects and arrays) $..author
* Wildcard matching all elements or property values $.store.book[*]
[start:end:step] Array slice operator inspired by Python slices $.store.book[0:2]
[?(<expr>)] Filter expression returning items where expression is true $.store.book[?(@.category == 'fiction')]
[0, 1] Union operator picking specific array indices or keys $.store.book[0, 2]

Evaluating JSONPath in Modern JavaScript and Node.js

As modern microservice architectures, GraphQL gateways, and API proxies exchange complex, heavily nested JSON data structures, retrieving targeted fields without writing repetitive nested loops is a necessity. JSONPath standardizes JSON query traversal across programming ecosystems.

1. Using JSONPath in Node.js with jsonpath / jsonpath-plus

In Node.js applications, install standard query packages via npm:

const jp = require('jsonpath');

const rawPayload = { /* incoming JSON */ };
const authors = jp.query(rawPayload, '$..author');
console.log(authors); // Array of matched author names

2. Performance: Native JavaScript vs JSONPath

While JSONPath excels in dynamic API gateways, declarative rules engines, and test assertions (e.g. Postman, Cypress), compiled native JavaScript array methods (such as data.store.book.map(b => b.author)) execute up to 20x faster in hot loops because they benefit from V8 engine JIT optimization.

Frequently Asked Questions

JSONPath is a query expression language for JSON, analogous to XPath for XML. In JavaScript, developers use libraries like jsonpath or jsonpath-plus (or native object traversal) to extract deep properties, filter collections using predicates like [?(@.price < 20)], and slice arrays without writing iterative boilerplate loops.
The double-dot notation (..) recursively traverses all levels of a nested JSON document. For example, $..author searches every object and array at any depth to collect all values under the key author.
Simple paths like $.store.book[0].title can be written as data?.store?.book?.[0]?.title with optional chaining. Filter queries like $..book[?(@.price < 10)] can be implemented using Array.prototype.flatMap() and Array.prototype.filter(). This tool automatically generates equivalent ES6 JavaScript for your queries.
Yes. All JSONPath parsing and query execution are evaluated 100% locally within your client browser. No queries or JSON data are sent across the network.