Click any value in the tree to get its JSONPath Β· Query JSONPath to highlight matches
Click a value in the tree β
JSON Path Finder displays the full JSONPath expression for any field in a JSON structure. Paste any JSON and click any value to instantly get its JSONPath (e.g., $.users[0].address.city) β useful for writing jq queries, configuring API response mappings, writing test assertions, and extracting specific values from deeply nested JSON without counting brackets manually.
JSONPath is a query language for JSON, analogous to XPath for XML. Syntax: $ is the root, . accesses object keys ($.user.name), [] accesses arrays ($.users[0]), [*] matches all array elements, .. is recursive descent (deep search), ? is a filter expression ($.users[?(@.age > 18)]). JSONPath is used in: jq (command line), AWS Step Functions, Kubernetes admission controllers, Grafana alerting, test frameworks (Jest, Cypress), and API gateways.
Common uses: debugging API responses by finding where a specific value is located in a deeply nested JSON object, writing assertions in API tests that reference specific fields, configuring JSON-to-database mappings (AWS Glue, ETL tools), setting up monitoring alerts that trigger on specific JSON field values, and writing jq scripts for command-line JSON processing.
Find path to nested field
Result: Click 'city' in {users:[{address:{city:'NYC'}}]} β $.users[0].address.city
Get all email fields
Result: Pattern: $..[*].email β selects all email fields at any nesting depth
jq equivalent
Result: $.users[0].name β jq '.users[0].name' β direct translation to jq query
What is jq and how is it different from JSONPath?
jq is a command-line JSON processor with its own query language, more powerful than JSONPath. jq can transform, filter, and reshape JSON. JSONPath is a read-only query language (just selects values). jq notation: . (root), .field, .[0], .[] (all array items), .field? (optional, no error if missing), | (pipe to next operation), select(.age > 18). JSONPath is used in configuration files (Kubernetes, AWS). jq is used for command-line JSON processing.
What is the difference between JSONPath and JMESPath?
Both are JSON query languages. JSONPath uses $. prefix and is more common in testing tools and monitoring. JMESPath (used by AWS CLI: aws s3api list-buckets --query 'Buckets[].Name') has different syntax: no $ prefix, uses [?] for filters. JMESPath is the standard for AWS CLI and boto3 --query parameter. Neither is a universal standard β tooling varies. This tool outputs JSONPath.
How do I use JSONPath in JavaScript?
The jsonpath-plus npm package: const result = JSONPath({ path: '$.users[*].name', json: data }). Native JavaScript doesn't have built-in JSONPath support. For simple cases, use optional chaining: data?.users?.[0]?.address?.city. For complex queries and filtering, use jsonpath-plus, jsonpath, or jmespath npm packages. In modern JavaScript: const names = data.users.map(u => u.name) is often clearer than JSONPath for simple cases.
What does the recursive descent operator (..) do?
The .. operator in JSONPath traverses the entire JSON tree recursively to find all matching keys at any depth. $..'name' finds all name fields regardless of nesting depth. Useful when you don't know the exact path but know the field name. Use with caution on large JSON β it traverses every node. Example: the Kubernetes admission webhook uses $..spec.containers[*].image to find all container images at any depth in a pod spec.
How do I test JSONPath expressions?
Tools: (1) This tool β click to get the path instantly. (2) jsonpath.com β test expressions against your JSON. (3) jq playground β for jq expressions. (4) Command line: echo '$JSON' | jq '.users[0].name'. (5) Postman β use JSONPath in test assertions: pm.expect(pm.response.json().users[0].name).to.equal('Alice'). (6) JavaScript: JSON.stringify(require('jsonpath').query(data, '$.users[*].name')).