YAML/JSON Path Tester - JSONPath & YAML Path Expression Tester
Quick Examples (Click to Load)
$.store.book[*].author
Get all book authors$.store.book[?(@.price < 10)]
Books under $10spec.containers[*].image
Kubernetes container imagesmetadata.labels.app
Kubernetes app labelJSONPath Syntax Reference
$
Root element@
Current element (in filters). or []
Child operator*
Wildcard (all elements)[start:end]
Array slice[?(<expr>)]
Filter expressionWhat is JSONPath?
JSONPath is a query language for JSON, similar to XPath for XML. It provides a way to extract specific data from a JSON document using path expressions. JSONPath is widely used in DevOps tools, CI/CD pipelines, and API testing.
Common JSONPath Operators
| Operator | Description | Example |
|---|---|---|
$ | Root element | $ |
@ | Current element (in filters) | @.price |
. | Child operator | $.store.book |
[] | Subscript operator | $.store.book[0] |
* | Wildcard (all elements) | $.store.book[*] |
[start:end] | Array slice | $.store.book[0:2] |
[?()] | Filter expression | $.store.book[?(@.price < 10)] |
Common Use Cases
Kubernetes Configuration
JSONPath is built into kubectl for extracting data from resources:
# Get all pod names
kubectl get pods -o jsonpath='{.items[*].metadata.name}'
# Get container images from a deployment
kubectl get deployment nginx -o jsonpath='{.spec.template.spec.containers[*].image}'
# Get all node IP addresses
kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}'CI/CD Pipelines
Extract values from configuration files:
# GitHub Actions example
- name: Get version
run: |
VERSION=$(cat package.json | jq -r '.version')
echo "VERSION=$VERSION" >> $GITHUB_ENVAPI Response Parsing
Query API responses in tests or scripts:
// Using JSONPath to extract data
const authors = jsonpath.query(response, '$.store.book[*].author');
const cheapBooks = jsonpath.query(response, '$.store.book[?(@.price < 10)]');YAML Path Expressions
YAML path expressions work similarly to JSONPath but are designed for YAML documents. Since YAML is a superset of JSON, you can use the same path syntax:
# Kubernetes Pod manifest
apiVersion: v1
kind: Pod
metadata:
name: my-pod
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2Path expressions for this YAML:
metadata.name→my-podmetadata.labels.app→nginxspec.containers[*].image→["nginx:1.14.2"]
Filter Expressions
Filter expressions allow you to select elements based on conditions:
| Expression | Description |
|---|---|
[?(@.price < 10)] | Elements where price is less than 10 |
[?(@.price > 20)] | Elements where price is greater than 20 |
[?(@.category == 'fiction')] | Elements where category equals ‘fiction’ |
[?(@.price != 8.95)] | Elements where price is not 8.95 |
Privacy & Security
All processing happens directly in your browser:
- No Server Communication: Your JSON/YAML data never leaves your device
- No Storage: Nothing is saved to localStorage, cookies, or servers
- Open Source: All code is transparent and auditable
Related Tools
Explore our other DevOps tools:
- kubectl Builder - Visual kubectl command builder
- Regex Lab - Test and debug regular expressions
- JWT Tools - Decode and create JSON Web Tokens
- SSL Tools - Certificate validation and key generation
Need help? All code is open-source. Visit our GitHub or contact us with questions or feedback.