Evaluating JSONPath Expressions Against JSON Data
The JSONPath Tester provides an interactive environment to evaluate JSONPath expressions against JSON structures. By inputting a JSON payload and a query expression, you can instantly see which values match your criteria along with the exact paths where those values reside. This process helps you verify that your queries target the correct elements before you implement them in your application code, API tests, or data pipelines.
The tool processes all inputs locally. Your JSON and JSONPath are tested in your browser. Nothing is uploaded to BroBroGo.
Input Specifications and Constraints
To ensure stable performance during evaluation, the tool enforces specific size and length limits on both inputs:
- JSON input: The text area accepts JSON payloads up to a maximum size of 500,000 characters. If your input exceeds this limit, the tool displays the error message:
This JSON is too large to test here. Try a smaller sample. - JSONPath expression: The query input field accepts expressions up to a maximum length of 4,000 characters. If an expression exceeds this limit, the tool displays the error message:
This JSONPath expression is too long to test here.
JSONPath Syntax and Query Patterns
JSONPath expressions navigate JSON structures using specific tokens and operators to filter, slice, and locate nested data. The tester supports common JSONPath patterns, allowing you to construct precise queries:
Dot and Bracket Notation
You can traverse object properties using dot notation (such as $.store.book) or bracket notation. The symbol $ represents the root object or array.
Recursive Descent
The recursive descent operator .. searches for a member name deeply nested within any level of the JSON hierarchy. For example, the expression $..price retrieves every price field regardless of its depth in the object tree.
Array Slices and Wildcards
Wildcards (*) match all elements in an array or all properties in an object. Array slices allow you to select specific ranges or steps from an array, such as selecting the first few elements or skipping elements at regular intervals.
Filter Expressions
Filter expressions apply a logical condition to filter arrays or objects. Filters are written as [?@.property < value], where @ represents the current element being processed. For example, [?@.price < 10] filters out any items where the price property is not strictly less than 10.
Handling Validation and Evaluation Errors
When testing queries, the tool validates both the structural integrity of the JSON payload and the syntax of the JSONPath expression. If either input is malformed, or if the evaluation cannot proceed, specific error messages are displayed:
| Error Scenario | Displayed Message |
|---|---|
| The JSON payload contains syntax errors (e.g., missing commas, unclosed brackets) | This JSON is not valid |
| The JSONPath expression contains syntax errors or unsupported operators | This JSONPath expression is not valid |
| The expression is syntactically valid but cannot be evaluated against the structure | Could not evaluate this JSONPath |
| The evaluation exceeds the execution time limit | This JSONPath took too long to run. Narrow the expression or use a smaller sample |
To prevent browser lockups during complex queries, the tool stops evaluating a JSONPath expression after a short time limit if it takes too long to run. This typically occurs when running broad recursive descent queries on large, deeply nested JSON structures. If a timeout occurs, you should narrow the scope of your expression or use a smaller JSON sample.
Understanding the Output and Match Limits
When a query executes successfully, the tool displays the results under the heading Matching values. Each matched item is presented with its corresponding value and the specific path where the value originated in the source JSON. This detailed view is organized under the Detail heading, allowing you to copy a specific value while retaining its original location within the hierarchy.
To maintain performance, the tool displays a maximum of 200 results. If your query produces more than 200 matches, the interface displays the count as Matches: 200+ along with the note Showing the first {max}. If no elements match your query, the interface displays No matches. Clearing the inputs resets the interface and displays the message Cleared.
Frequently Asked Questions
What JSONPath syntax can I use?
Use common JSONPath patterns such as $.store.book[*].title, recursive descent with $..price, filters like [?@.price < 10] and array slices.
Why does each result show a path?
The path shows where the value came from in the source JSON, so you can copy a match without losing its location.
Why can a query time out?
Very broad recursive queries or huge samples can take too long. The tester stops them after a short limit so you can narrow the expression or use a smaller sample.