YAML/JSON Path Tester - JSONPath & YAML Path Expression Tester

0 matches found

Quick Examples (Click to Load)

JSON $.store.book[*].author Get all book authors
JSON $.store.book[?(@.price < 10)] Books under $10
YAML spec.containers[*].image Kubernetes container images
YAML metadata.labels.app Kubernetes app label

JSONPath Syntax Reference

$ Root element
@ Current element (in filters)
. or [] Child operator
* Wildcard (all elements)
[start:end] Array slice
[?(<expr>)] Filter expression

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.

OperatorDescriptionExample
$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)]

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}'

Extract values from configuration files:

# GitHub Actions example
- name: Get version
  run: |
    VERSION=$(cat package.json | jq -r '.version')
    echo "VERSION=$VERSION" >> $GITHUB_ENV

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 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.2

Path expressions for this YAML:

  • metadata.namemy-pod
  • metadata.labels.appnginx
  • spec.containers[*].image["nginx:1.14.2"]

Filter expressions allow you to select elements based on conditions:

ExpressionDescription
[?(@.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

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
Pro Tip
Bookmark this page for quick access when debugging Kubernetes configs or API responses. The examples load instantly to help you test common patterns.

Explore our other DevOps tools:


Need help? All code is open-source. Visit our GitHub or contact us with questions or feedback.