n8n filter()
Returns a new array containing only the elements for which the condition is true.
Syntax
array.filter(item => condition)
Example
$json.orders.filter(o => o.status === 'paid')
Result: Paid orders only
filter()Returns a new array containing only the elements for which the condition is true.
array.filter(item => condition)
$json.orders.filter(o => o.status === 'paid')
Result: Paid orders only
Learn how to use JavaScript filter() method inside an n8n Code node to keep only active users.
Practice keeping only matching objects in an array with filter() inside n8n expressions.