JSONPath Tester: Test Expressions & Debug Results Online
JSONPath tester online: test and debug JSONPath expressions with live match highlighting, query results, and syntax error feedback.
Updated 2026-08-16
Related Tools
JSON Formatter: Beautify, Validate & Minify JSON Online
Regex Tester Online: Test JavaScript Regular Expressions
Code Beautifier: Format HTML, CSS & JavaScript Online
Code Minifier: Minify HTML, CSS & JavaScript Online
CSS Unit Converter: px, rem, em, vw, vh & Percent Online
CSV to JSON Converter: Convert CSV to JSON Online Instantly
Features
- Real-time JSONPath evaluation: see query results update instantly as you type your expression
- Full JSONPath syntax support including dot notation, bracket notation, wildcards, and recursive descent
- Array slice operator [start:end:step] for extracting sub-arrays from JSON data
- Filter expression support [?(@.key comparison value)] for conditional data extraction
- Recursive descent (..) to search deeply nested JSON structures for matching keys
- Built-in path examples library with common JSONPath patterns for quick learning
- Match count display showing exactly how many results your expression returns
- Formatted JSON output with syntax highlighting for easy result inspection
- One-click copy results to clipboard for use in your code or documentation
- JSON validation with clear error messages for invalid input or malformed paths
- Negative array index support (e.g., [-1] for last element)
- length() function support for counting array elements in results
How to Use
- 1Paste or type your JSON data in the left textarea. The editor validates JSON in real-time; a green indicator means valid, red means there's an error.
- 2Enter a JSONPath expression in the input field, starting with $. For example, $.store.book[*].title selects all book titles.
- 3Use the example paths dropdown to load common JSONPath patterns and see how they work against your data.
- 4View the query results on the right panel; matched values are shown as formatted JSON with a match count.
- 5Click the copy button to copy results to your clipboard, or use Clear to reset the workspace.
- 6Experiment with filter expressions like [?(@.price < 10)] to extract data matching specific conditions.
- 7Try array slicing with [start:end:step] syntax, similar to Python, e.g., $..book[0:2] for the first two books.
- 8Use recursive descent $..* to explore every value in your JSON document and discover hidden data structures.
- 9Combine multiple JSONPath operators in a single expression: for example, $..book[?(@.price > 10)].title finds all titles of books priced over $10 at any nesting level.
Frequently Asked Questions
What is JSONPath?
JSONPath is a query language for JSON, similar to XPath for XML. It provides a simple way to navigate, filter, and extract specific data from complex JSON documents using path expressions. JSONPath was created by Stefan Gössner and has become widely adopted across many programming languages and tools. It uses a compact syntax that combines dot notation (like JavaScript) with XPath-inspired features like recursive descent and filter expressions.
What JSONPath syntax is supported?
This tool supports the most common JSONPath operators:
• `$`: Root object (all paths start here)
• `.key` or `['key']`: Child operator to access object properties
• `..`: Recursive descent to search nested structures
• `*`: Wildcard to select all elements or properties
• `[n]`: Array index (supports negative indices for reverse access)
• `[start:end:step]`: Array slice operator
• `[?(expression)]`: Filter expression with comparison operators (==, !=, <, >, <=, >=)
• `@`: Current node reference in filter expressions
• `length()`: Function to get array length
How is JSONPath different from XPath?
JSONPath is to JSON what XPath is to XML. While they share similar concepts (path expressions, wildcards, predicates/filters), there are key differences:
• JSONPath uses `$` for the root element, XPath uses `/`
• JSONPath uses `.` for child access, XPath uses `/`
• JSONPath uses `..` for recursive descent, XPath uses `//`
• JSONPath uses `[n]` for array indexing, XPath uses `[n+1]` (1-based)
• JSONPath uses `[?()]` for filters, XPath uses `[predicate]`
• JSONPath uses `@` for current node in filters, XPath also uses `@` but for attributes
How do filter expressions work?
Filter expressions in JSONPath use the syntax `[?(expression)]` to conditionally select array elements. The expression is evaluated for each element, with `@` representing the current element. Common patterns:
• `[?(@.price < 10)]`: Elements where price < 10
• `[?(@.author == 'Tolkien')]`: Elements where author equals 'Tolkien'
• `[?(@.stock)]`: Elements where stock property is truthy
Supported operators: ==, !=, <, >, <=, >=. String literals should be quoted (single or double quotes). Number literals are unquoted.
Why does recursive descent (..) return more matches than I expected?
`..` searches every nesting level, so the same value can be matched multiple times at different paths; for example, `$..title` may return a title that also appears nested under another matched branch. It also includes matches inside arrays and nested objects you did not intend. To narrow results, combine `..` with filters (`$..[?(@.price > 10)]`) or use an explicit path when you know the structure.
Does JSONPath support array slicing?
Yes. JSONPath supports array slicing with the `[start:end:step]` syntax, similar to Python's slice notation:
• `[0:3]`: First three elements (indices 0, 1, 2)
• `[5:]`: From index 5 to the end
• `[:3]`: First three elements
• `[::2]`: Every second element
• `[-1:]`: Last element
• `[-3:-1]`: Third-last and second-last elements
Slice indices can be negative to count from the end of the array.
How do I use JSONPath in Python to extract data?
pip install jsonpath-ng, then: from jsonpath_ng.ext import parse; matches = parse('$.store.book[*].title').find(data): collect values with [m.value for m in matches]. jmespath is a popular alternative but uses a different syntax: jmespath.search('store.book[*].title', data). Debug your expression here first, then port it.
How do I use JSONPath in C#?
Newtonsoft.Json (Json.NET) has JSONPath built in: JToken.Parse(json).SelectTokens("$.store.book[*].title") returns all matching JTokens, and SelectToken returns a single value. The expression syntax matches what this tool evaluates, so you can verify the path here before writing the C# code.
Why is my jsonpath tester online slow on a large JSON document?
Evaluating recursive descent (`$..*`) or wildcards over a very large document is expensive because the tool walks every node in your browser. If results stall: use explicit paths like `$.store.book[*]` instead of `..`, avoid `$..*`, and trim the JSON to the smallest snippet that reproduces your case.
How do I handle JSON or JSONPath syntax errors?
The tool validates both your JSON data and JSONPath expression in real-time. For JSON errors: check for missing commas, trailing commas, unquoted keys, or mismatched brackets. For JSONPath errors: ensure your path starts with $, check bracket matching, and verify that filter expressions use correct comparison operators.
What is the difference between dot notation and bracket notation?
Dot notation ($.store.book[0].title) is shorter and more readable for simple property access. Bracket notation ($['store']['book'][0]['title']) is required when property names contain special characters (spaces, dots, brackets) or when using variables. The tool supports both and you can mix them freely.
Why doesn't my expression match anything?
JSONPath is case-sensitive: $.user and $.User are different paths. Also check: bracket vs dot notation ($.items[0].name vs $['items'][0]['name']; both work here, but keys with special characters like hyphens or spaces require bracket notation), filter syntax ($.items[?(@.price > 10)] needs the ?(@...) form), and whether you are testing against a JSON object or an array (use $[*] for arrays). The error panel shows the exact failing position to help you fix the expression.
Why does my JSONPath expression work in one library but fail in this jsonpath tester?
There is no single JSONPath standard: implementations (Goessner's original, Jayway, jsonpath-ng, jmespath) support different operators and edge cases, such as union `[,]`, script expressions, or the `~` parent operator. Test your expression here first, then check the target library's supported syntax before porting it.