jmespath: Simplest Explanation for Using the jmespath Syntax post thumbnail image

jmespath: Simplest Explanation for Using the jmespath Syntax

In this content, the most focus is let you use jmespath the fatest way.

jmespath can be used in command line for querying json objects, i.e. arg ‘–query “{jmespath }”‘ can be used in Azure CLI to query properties of returned object.

You can view more details at

Now, let’s get started:

Name 'a' as root, 'b'/'c'/'d'… as a nested child in order.

Operator: based on current object type, which either:


a[*].b to get value of b named property in the list
[start:stop:step] : a[0:5] get 5 items from index 0 to 5.
a[::2] get values of even indices
a[?b=='something'] to filter out 
a[*] shows full orginal structure while a[] flattens the a into a list items
[a[*].b, a[*].c] | [] : join properties b and c into a flattened array.


a.b to show value b only

Function: based on current context i.e. array, object or attribute


length(a) show count of all items
max_by(a,&b) show the only object that have the highest value of b.




a[?contains(@,'foo') == 'true'] character @ represent for the current item in a.

That’s just the end.

Thanks for reading and happy coding.

Leave a Reply

Related Post