Quick Reference

Basic Selectors
  • $ - The root of the document.
  • .child or ['child'] - Select a child of a mapping node.
  • [1] - Select the second element of a sequence (0-indexed).
  • [-1] - Select the last element of a sequence.
  • [0:5] - Select elements from index 0 up to (but not including) 5.
  • [*] - Select all elements of a sequence or all values of a map.
  • ..child - Recursive descent: find all children named 'child' at any level.
Filters `[?(...)]`

Filters allow you to select nodes based on conditions.

  • @ - The current node being processed in the filter.
  • @.price < 10 - Select nodes where the 'price' child is less than 10.
  • @.author == 'Nigel Rees' - Select nodes where the author is 'Nigel Rees'.
  • @.isbn - Select nodes that have an 'isbn' child (existence).
  • @.title =~ /Honour/ - Select nodes where the title matches a regular expression.

Combine expressions with && (and) and || (or).

Property Name Operator `~`

Use ~ to get the name of a property instead of its value. This can only be used at the end of a path.

  • .child~
  • ['child']~
  • ['child1', 'child2']~
Helm/Kubernetes Examples

Sample expressions for inspecting rendered Helm templates.

Example: Find the image of the 'my-app' container in a Deployment.

$.spec.template.spec.containers[?(@.name=='my-app')].image

Example: Find a specific annotation on a Service.

$.metadata.annotations['my-annotation/key']

Example: Find all Pods that have a 'my-app' container.

$..spec.template.spec.containers[?(@.name=='my-app')]