We use cookies to understand how DevToolsHub is used and to improve your experience. You can choose which types of cookies to allow.
Query JSON data using JSONPath expressions and explore paths.
Loading...
Loading...
JSONPath is a query language for JSON, analogous to XPath for XML. It allows you to navigate into JSON structures and extract specific values, objects, or arrays using compact path expressions. Just as XPath uses expressions like /bookstore/book[1]/title to select elements from an XML document, JSONPath uses expressions like $.store.book[0].title to select values from a JSON document. The $ symbol represents the root object, and you navigate downward using dot notation for object keys and bracket notation for array indices.
JSONPath was originally proposed by Stefan Goessner in 2007 as a lightweight alternative to XML XPath for JSON data. Since then, it has become the de facto standard for querying JSON and is supported by libraries in virtually every programming language. The JSONPath specification was formally documented in RFC 9535 in 2024, bringing standardization to the various implementations that had diverged over the years.
JSONPath supports a rich set of operators: dot notation ($.key) for object access, bracket notation ($[0]) for array indexing, wildcards ($[*]) for matching all elements, recursive descent ($..key) for deep searching, filter expressions ($[?(@.price > 10)]) for conditional matching, and array slicing ($[1:3]) for selecting sub-ranges. This makes it powerful enough for complex data extraction tasks while remaining concise and readable.
DevToolsHub’s JSON Path Finder runs entirely in your browser using the jsonpath-plus library, which is one of the most compliant and feature-rich JSONPath implementations available. It supports the full RFC 9535 specification including filter expressions, recursive descent, and all standard operators. Your data never leaves your device, making it safe for use with sensitive JSON.
$.store.book[*].title). Results update automatically as you type.[].Here is a comprehensive reference of JSONPath syntax and what each expression does:
| Expression | Description |
|---|---|
| $ | Root element — the entire JSON document |
| $.key | Dot notation — access a key on the current object |
| $['key'] | Bracket notation — useful for keys with special characters |
| $[0] | Array index — select element at position 0 |
| $[*] | Wildcard — select all array elements or object values |
| $..key | Recursive descent — find all occurrences of key at any depth |
| $[?(@.expr)] | Filter expression — select items where condition is true |
| $[start:end] | Array slice — select elements from start to end index |
| $.* | Wildcard on root — select all top-level values |
| @ | Current element — used inside filter expressions |
Filter expressions support comparison operators (==, !=, >, <, >=, <=), logical operators (&&, ||, !), and regex matching with =~. For example, $[?(@.name =~ /^A/i)] matches all items where the name starts with “A” (case-insensitive).
Both JSONPath and jq are tools for querying and transforming JSON data, but they serve different purposes and have distinct strengths. Understanding when to use each can significantly improve your workflow.
| Feature | JSONPath | jq |
|---|---|---|
| Purpose | Querying / extracting values | Querying + transformation pipeline |
| Syntax style | Path-based (like XPath) | Pipe-based (like Unix pipes) |
| Transformations | Limited (select only) | Full (map, reduce, sort, group) |
| Learning curve | Low — familiar dot notation | Moderate — own language |
| Browser support | Yes — pure JS libraries | Limited — requires WASM build |
| Best for | Quick lookups, API exploration | Complex data pipelines, scripting |
In practice, JSONPath is ideal when you need to quickly extract specific values from a JSON structure — for example, getting all book titles from an API response, filtering items by price, or finding all occurrences of a key at any depth. jq is the better choice when you need to transform JSON data: sorting, grouping, computing aggregates, or building complex pipelines that chain multiple operations. JSONPath’s simplicity and browser-native execution make it perfect for interactive tools like this one, while jq shines in command-line scripts and data processing workflows.
Loading...