Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 682 Bytes

jmespath-primer.md

File metadata and controls

49 lines (39 loc) · 682 Bytes

JMESPath Primer

Using the --query feature in the az devops cli is very alien at first. Here's a quick primer.

Basic Queries

Let's assume we have a simple JSON structure:

[
  {
     "name": "Bryan",
     "fruit": "Orange",
     "car": "SUV"
  },
  {
     "name": "Mark",
     "fruit": "Banana",
     "car": "Sedan"
  }
]

Return the first element: "[0]"

{
   "name": "Bryan",
   "fruit": "Orange",
   "car": "SUV"
}

Return the name element of first element: "[0].name"

{
   "name": "Bryan"
}

Return multiple elements: "[0].{Name:name, Car:car}"

{
   "Name": "Bryan",
   "Car": "SUV"
}