Step: map(select(...)) — filter arrays

map(select(...)) — filter arrays

Because map runs any filter, map(select(cond)) keeps only the elements that match — returning a filtered array (vs. .[] | select, which returns a stream).

map(select(.price < 50))

Your turn: return an array of the products in the "office" category.

Input:
[
  {
    "name": "Widget",
    "price": 25,
    "category": "tools"
  },
  {
    "name": "Gadget",
    "price": 80,
    "category": "tools"
  },
  {
    "name": "Notebook",
    "price": 12,
    "category": "office"
  },
  {
    "name": "Pen",
    "price": 3,
    "category": "office"
  }
]
Expected:
[
  {
    "name": "Notebook",
    "price": 12,
    "category": "office"
  },
  {
    "name": "Pen",
    "price": 3,
    "category": "office"
  }
]
Step 19 of 27