How to Test JSONPath Expressions
Paste valid JSON and a JSONPath expression, then inspect matching results. Start with a simple path before adding filters. This tool uses JSONPath Plus, whose extensions may differ from other JSONPath engines.
JSONPath Syntax Basics
The root is $, dotted names select properties and brackets select indexes or quoted keys. A wildcard selects multiple children. Use bracket notation for names that include punctuation or spaces.
Selecting Arrays, Nested Fields and Wildcards
For a users array, $.users[0] selects its first entry and $.users[*].name selects available names. Missing properties may produce no match rather than a null. Check result count as well as returned values.
Filtering JSON With JSONPath
Filters select entries matching conditions. Support and syntax can vary across libraries, so test the exact expression in your target runtime too. Do not treat a match as proof of schema validity.
JSONPath Examples
For {"items":[{"price":5},{"price":12}]}, $.items[*].price selects both numeric values. Compare simple paths with filtered forms on a known sample before applying them to a large response.
More examples and technical details
What JSONPath Is
JSONPath is a query language for JSON. If you have used XPath to pluck nodes out of an XML document, JSONPath is the same idea carried over to JSON: a compact expression that describes a path through the data and returns whatever matches. It was proposed by Stefan Goessner back in 2007, and the syntax he sketched out then is still the core of every implementation you will meet today, including the one running on this page.
The appeal is that you can pull exactly the values you care about out of a large, deeply nested document without writing a loop or hand-walking the tree. You write one line, you get a list of matches back, and you move on.
The Core Syntax
Most of JSONPath comes down to a handful of building blocks that you combine into a path. Here is the set you will use ninety percent of the time:
| Syntax | Meaning | Example |
|---|---|---|
| $ | The root of the document | $ |
| .key | A named child property | $.store |
| ['key'] | A child by bracket notation | $['store'] |
| [n] | An element at a given array index | $.book[0] |
| [*] | A wildcard matching every element | $.book[*] |
| .. | Recursive descent at any depth | $..price |
| [start:end] | A slice of an array | $.book[0:2] |
| [-1:] | The last element of an array | $.book[-1:] |
| [?(@.price < 10)] | A filter, where @ is the current node | $.book[?(@.price < 10)] |
Worked Examples
Say you are querying a small book store document, an object with a store that holds an array of book objects (each with a title, author, and price) and a single bicycle. These queries show how the pieces fit together:
Where JSONPath Shows Up
Once the syntax clicks you start seeing places to use it everywhere. Extracting a few fields from an API response is the everyday case, especially when the payload is big and you only want the ids or the prices. Config and CI tools lean on it heavily, letting you reference a value deep in a settings file without duplicating the whole structure. Log processing pipelines use it to fish specific attributes out of structured JSON logs.
Test frameworks are another big one: many assertion libraries let you write a JSONPath expression and check that the value it returns matches what you expect, which keeps response assertions short and readable. It is worth knowing that jq, the command-line JSON processor, solves the same problem with a related but different syntax, so a JSONPath expression will not drop straight into jq, though the mental model transfers cleanly.
Every expression here is evaluated locally in your browser, so your JSON never leaves your device. Want to reshape or inspect the data next? Pair this with the JSON formatter and JSON viewer from the toolkit.
Standards and references
Frequently asked questions
What is JSONPath?
JSONPath is a query notation for selecting values from JSON structures.
How do I test a JSONPath expression?
Paste JSON, enter an expression beginning at $ and inspect the matched values.
Can JSONPath filter arrays?
Yes. Supported filter expressions can select array entries by conditions.
What is the difference between JSONPath and JSON Pointer?
JSON Pointer identifies one location; JSONPath can query multiple locations and apply selection logic.
Is JSON uploaded?
No. Input is processed in this browser tab and is not uploaded by the tool. Copy and download are actions you control; ordinary page analytics do not receive tool input.