UFOZoo

JSONPath Tester — Test Expressions & Debug Results Online

Test JSONPath expressions in real-time with full syntax support. Features dot/bracket notation, wildcards, filters, and match count display. Browser-based.

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

  1. 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.
  2. 2Enter a JSONPath expression in the input field, starting with $. For example, $.store.book[*].title selects all book titles.
  3. 3Use the example paths dropdown to load common JSONPath patterns and see how they work against your data.
  4. 4View the query results on the right panel — matched values are shown as formatted JSON with a match count.
  5. 5Click the copy button to copy results to your clipboard, or use Clear to reset the workspace.
  6. 6Experiment with filter expressions like [?(@.price < 10)] to extract data matching specific conditions.
  7. 7Try array slicing with [start:end:step] syntax, similar to Python — e.g., $..book[0:2] for the first two books.
  8. 8Use recursive descent $..* to explore every value in your JSON document and discover hidden data structures.
  9. 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.

What is recursive descent (..) in JSONPath?

The `..` operator (recursive descent) searches through all nested levels of the JSON structure for matching property names. For example, `$..price` finds every `price` property at any depth in the document, whether it's on the first level, inside nested objects, or inside array elements. This is extremely useful for extracting all values of a given key from deeply nested structures without having to specify the full path. Use `$..*` to select every value in the entire document.

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.

Is my JSON data sent to a server?

No. All processing — JSON parsing, JSONPath evaluation, and result formatting — happens entirely in your browser using JavaScript. Your JSON data and path expressions never leave your device. There is no backend server, no API calls, and no data collection. You can disconnect from the internet after the page loads and the tool continues to work perfectly. This makes it safe to test with sensitive or confidential JSON data.

What are common use cases for JSONPath?

JSONPath is widely used for: • Extracting specific fields from API responses (e.g., get all user emails) • Filtering arrays based on conditions (e.g., orders over $100) • Navigating deeply nested JSON structures without writing complex loops • Testing API endpoint responses during development • Data transformation and ETL pipelines • Validating JSON data structures contain expected values • Debugging complex JSON documents by exploring their contents • Querying JSON-based databases or configuration files

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.

Related Tools