DevToys Web Pro

free web developer tools

Blog
Rate us:
Try browser extension:

JSONPath Tester

JSONPath Expression

JSON Input

  • Results

  • Loading editor...
    No results found
    SyntaxDescription
    $The root object or array
    @Current node (used in filter expressions)
    object.propertyDot-notated child
    ['object'].['property']Bracket-notated child or children
    ..propertyRecursive descent
    *Wildcard. Selects all elements
    [n]Selects the n-th element from an array
    [n1,n2]Selects n1 and n2 array items (union)
    [start:end:step]Array slice operator
    ?(expression)Filter expression
    (expression)Script expression
    Technical details

    How the JSONPath Tester Works

    What the Tool Does

    The JSONPath tester allows you to query nested JSON data using JSONPath expressions, similar to how XPath works for XML. This jsonpath tester functions as a JSONPath expression tester and json selector, helping developers extract specific values, arrays, or objects from complex JSON structures. When you need to test jsonpath online, this tool shows all matching values and their paths. It supports JSONPath syntax including dot notation ($.store.book), bracket notation ($['store']['book']), wildcards ($..*), array slicing, and filtering expressions. This tool follows jsonpath-plus semantics; JSONPath implementations vary, so if your expression works elsewhere but not here, it may be a dialect difference. It displays both matched values and JSONPath paths, making it easy to understand how expressions navigate through JSON structures.

    Common Developer Use Cases

    Developers use JSONPath testers when working with API responses, configuration files, or complex nested JSON data structures. A JSONPath expression tester helps extract specific fields from deeply nested objects, filter arrays by predicate, or find all occurrences of a particular key. Many developers use JSONPath testers to query JSON data from REST APIs, parse log files, or navigate complex configuration objects. The tool is valuable when debugging data transformations, validating API responses, or understanding complex JSON schemas. Before running JSONPath queries, you may want to format your JSON using the JSON Formatter for better readability. For configuration files, the JSON ↔ YAML Converter can help convert between formats. When inspecting array data, the JSON Array to Table tool can export results to tabular format for easier analysis.

    Data Formats, Types, or Variants

    JSONPath provides multiple ways to navigate JSON structures. The tool supports root selector ($), child selectors (. or []), descendant selectors (..), array indexing ([0], [-1]), and array slicing ([0:3]). Common JSONPath expressions developers use:

    • $.items[*].id — Extract all id fields from items array
    • $..id — Find all id fields at any nesting level
    • $['key-with-dash'] — Access keys with special characters
    • $..book[?(@.price < 10)].title — Filter books by price and extract titles

    These expressions demonstrate how JSONPath can query nested arrays, filter objects by predicate, and extract specific fields from complex structures.

    Common Pitfalls and Edge Cases

    One common mistake is confusing JSONPath with JavaScript object property access, as JSONPath uses different syntax for array filtering and wildcards. Another issue is understanding when to use dot notation vs bracket notation: dot notation works for simple keys, but bracket notation is required for keys with special characters or when using expressions. Array indexing can be tricky: negative indices like [-1] refer to the last element, but not all JSONPath implementations support this. Filtering expressions must use the correct comparison operators and reference the current item with @. Descendant selectors (..) can return unexpected results if they match more elements than intended. Developers should test JSONPath expressions with various JSON structures, including edge cases like empty arrays, null values, and deeply nested objects. Some JSONPath implementations have subtle differences in how they handle edge cases, so testing is essential.

    Errors and Validation

    When working with JSONPath, several error conditions can occur. Invalid JSON input will result in a parsing error before the JSONPath expression is evaluated. Invalid JSONPath expressions will return an error message indicating what's wrong with the syntax. Empty results are returned as an empty array when the expression doesn't match any values in the JSON structure—this is normal behavior, not an error. The tool validates both JSON syntax and JSONPath expression syntax, providing clear error messages for malformed input. If your JSONPath expression is valid but returns no results, the expression may not match the structure of your JSON data, or the data may not contain the expected fields.

    When to Use This Tool vs Code

    Use this JSONPath tester for quick query development, debugging complex expressions, or exploring JSON data structures. It's ideal for testing JSONPath expressions before implementing them in code, especially when working with unfamiliar APIs or complex nested data. The visual feedback helps identify why expressions match or don't match specific data. For production code, use JSONPath libraries integrated into your application that can process JSON data efficiently. Browser tools excel at interactive development and exploration, while code-based solutions provide performance, type safety, and integration with data processing pipelines. For large datasets or high-performance applications, native JSONPath implementations in your programming language provide better performance than browser-based tools.