array_where_in Filter
Removes elements from the array that do not have a specified item value that is contained within the given array:
{% set prices = [
{'product':'desk','price':200},
{'product':'chair','price':80},
{'product':'bookcase','price':150},
{'product':'pencil','price':30},
{'product':'door','price':100},
] %}
{{ prices|array_where_in('price', [150,200])|array_values|json_encode }}
{# [{"product":"desk","price":200},{"product":"bookcase","price":150}] #}