JSONPath Query

Query, filter and extract data from JSON with JSONPath: $ root, .key, [0], [*] and .. recursive descent.

Common expressions:
Drop a file here
or click the button below to choose a local file
.json / .txt / .csv, up to 10 MB, parsed locally in your browser
Everything runs locally in your browser. No data is uploaded.

Extract and filter JSON data with path expressions

What is a JSONPath query?

JSONPath is a path expression syntax for locating and extracting JSON data. It can quickly find fields in objects, nested objects, and arrays, and can filter array elements with matching conditions. This tool is useful for querying API responses, configuration files, log data, and other JSON documents.

Basic JSONPath syntax

$ represents the JSON root node; $.users accesses the users property under the root; $.users[0] selects the first array element; $.users[*] selects all elements in the users array; $.users[*].name selects the name from every element in the users array; $..price recursively searches for a property named price at any depth.

Array indexes support negative values. For example, [-1] can select the last element of an array. The wildcard [*] can be used to query all elements at once.

How to filter arrays with JSONPath

Use a [?()] filter expression when you need to select array elements based on field values. For example, $.users[?(@.age > 18)] selects users whose age is greater than 18. @ represents the current array element, and properties inside the condition can be accessed with @.field.

Filter conditions support the comparison operators ==, !=, >, >=, <, and <=. Multiple conditions can be combined with &&, ||, and !, and parentheses can be used to control precedence. For example, $.users[?(@.age >= 18 && @.active == true)] selects elements where age is at least 18 and active is true.

How to read JSONPath query results

After the query runs, the result area displays the matched data and its path. Paths use JSONPath notation, such as $.users[0].name, so you can identify exactly which field or array element was matched.

A standard JSON array result is also provided and can be copied or downloaded as a JSON file. The statistics show the number of matches. When there are no matches, the tool clearly reports that no results were found. To prevent the page from becoming too long, result cards display at most the first 200 matches, while the complete result remains available in the JSON output.

Common JSONPath expressions

The page provides buttons for common expressions that can be run against the example data. For example, $ queries the entire JSON document, $.users queries users, $.users[*].name queries all user names, $..price searches for price at any depth, and $.users[?(@.age > 18)] filters users by age.

These expressions can be used as templates by changing field names, array indexes, and filter conditions. They are useful for learning JSONPath syntax or quickly locating data in actual JSON documents.

How to query a local JSON file

Switch to the file upload tab and drag a .json file onto the page, or select a local file. The file is read directly in the browser, with a 10 MB limit per file. After the file is loaded, the current JSONPath expression is executed automatically.

What to do when a JSONPath query returns no results

If the expression does not produce an error but returns nothing, first check the actual JSON hierarchy and data types. For example, when users is an array, you normally need $.users[*] or $.users[0]; you cannot treat the array directly as an object with $.users.name. To find a field with the same name at nested levels, try $..name.

If a filter expression returns no results, check the field name, field type, and comparison condition. For example, comparing the number 18 with the string \"18\" may produce different results. If the expression itself has a syntax error, check that $, dots, brackets, and ?() are correctly closed.

Supported JSONPath syntax

The current implementation supports the root node $, property access, array indexes, negative indexes, the wildcard [*], recursive descent .., and [?()] filter expressions. Filter conditions support ==, !=, >, >=, <, <=, &&, ||, !, and parentheses. The tool does not claim to support every extension in the complete JSONPath standard.

How do you write a JSONPath expression?

JSONPath uses path expressions to locate JSON data: $ represents the root node, .key accesses a property, [0] accesses an array element, [*] matches all elements, and $..key recursively searches for a property with the same name at any depth.

To filter arrays, use expressions such as [?(@.age > 18)] to select elements by field value, and combine multiple conditions with &&, ||, and !.

  • Supports $, .key, array indexes [0], negative indexes, wildcard [*], and recursive descent $..key
  • Supports [?()] filter expressions for selecting JSON array elements by field values
  • Filter conditions support ==, !=, >, >=, <, <= as well as &&, ||, and ! combinations
  • Results show matching paths and values with standard JSON array output that can be copied or downloaded
  • Uploaded JSON files are limited to 10 MB, and the current expression runs automatically after loading
  • Everything runs locally in the browser, and input data is not uploaded to the server
To compare field changes between two JSON documents, use JSON Diff. To merge multiple JSON objects, use JSON Merge. To organize JSON data into a table, use JSON → CSV. To check whether JSON structure follows defined rules, use JSON Schema Validator.
Comments 0
No comments yet. Be the first to comment!
avatar
Comment content cannot be empty
0/255