JSONPath Finder: Query JSON Like a Database
JSONPath lets you extract specific values from JSON documents without writing traversal code. Enter a JSONPath expression, paste your JSON, and instantly see what matches — whether that's a single value deep in a nested object, all items matching a filter condition, or every occurrence of a key anywhere in the document.
$ = root. . = child. .. = recursive descent. [*] = all children. [?(...)] = filter. [n] = index. [a:b] = slice.
JSONPath Syntax Reference
$ is the root. .key or ['key'] accesses a property. [n] accesses an array element (negative indices count from end). [*] selects all children of an object or array. ..key uses recursive descent to find all occurrences at any depth. [a:b] is an array slice. [a,b,c] is a union of multiple indices or keys. [?(@.prop op val)] filters array elements by a condition on a property.
Filter Expressions
Filter expressions [?(@.prop op value)] select array elements where the condition is true. @ refers to the current item. Comparison operators: == (equals), != (not equals), < (less than), > (greater than), <= (less than or equal), >= (greater than or equal). Existence checks [?(@.key)] select items where the key exists. Filters are evaluated against each array element in the current node set.
JSONPath in Production
JSONPath is used in AWS IAM policies and CloudWatch Logs Insights, Kubernetes JSONPath kubectl output formatting, REST Assured API test assertions, Gatling and JMeter performance tests, Karate API testing framework, and Azure Logic Apps data operations. Learning JSONPath is a broadly useful skill for DevOps and API development.
Practical Examples
Extracting Data from an API Response
Use JSONPath to pull specific values from a complex nested API response.
- 1.Paste the API response JSON
- 2.Try $.data[*].id to get all IDs
- 3.Use [?(@.status == 'active')] to filter active items
- 4.Use $..email for recursive extraction of all email fields
Querying a Kubernetes Manifest
Extract specific fields from a Kubernetes JSON manifest.
- 1.Paste the kubectl get pods -o json output
- 2.Use $.items[*].metadata.name for all pod names
- 3.Use $.items[?(@.status.phase == 'Running')] for running pods
- 4.Use $..containerPort to find all exposed ports
Supported JSONPath Features
- $ root, .key child, ['key'] bracket notation
- [n] array index (negative = from end)
- [*] wildcard — all children
- ..key recursive descent at any depth
- [a:b] array slice (Python-style)
- [?(@.prop op value)] filter expressions
Good Use Cases
- Extracting fields from complex API responses
- Querying Kubernetes and cloud provider JSON output
- Testing API response structure in Postman / Insomnia
- Data pipeline transformation and validation
Frequently Asked Questions
What is JSONPath?
JSONPath is a query language for JSON, analogous to XPath for XML. It was created by Stefan Goessner in 2007. JSONPath expressions navigate JSON structures using dot notation ($.store.book) and bracket notation ($.store['book']). It is used in AWS, Kubernetes, REST API testing, and many data processing pipelines.
What does $ mean in JSONPath?
$ refers to the root element of the JSON document. All valid JSONPath expressions start with $. From there you can navigate with .key for object properties, [n] for array indices, [*] for all elements, and ..key for recursive descent.
What are filter expressions?
Filter expressions use [?(@.property op value)] syntax to select array elements that match a condition. For example, $.store.book[?(@.price < 10)] returns books with price less than 10. The @ symbol refers to the current element being evaluated. Supported operators: ==, !=, <, >, <=, >=.
What is recursive descent (..) ?
$..key finds all occurrences of 'key' anywhere in the document, at any nesting level. $..author returns all author values in the entire document tree, not just at a specific path. This is useful for extracting a field from deeply nested or variably structured JSON.