Step: Filter expression: [?(@.x<10)]

Filter expression: [?(@.x<10)]

Filter expressions let you keep only the elements that match a condition. The syntax is [?(<expression>)], where @ refers to the current element being tested.

For example $.pets[?(@.age>4)] returns every pet whose age field is greater than 4, and $.pets[?(@.kind=="dog")] returns only the dogs.

You can compare numbers with <, <=, >, >=, test equality with ==, and combine conditions with &&/||.

Now write a filter expression that returns the name of every dog below.

Input:
{
  "pets": [
    {
      "name": "Bear",
      "kind": "dog",
      "age": 3
    },
    {
      "name": "Jerry",
      "kind": "cat",
      "age": 5
    },
    {
      "name": "Rex",
      "kind": "dog",
      "age": 7
    }
  ]
}
Expected:
[
  "Bear",
  "Rex"
]
Step 9 of 9