How to search an array for a particular item?

I have json data and I need to search an array in that data for an exact match with a value

I am using the IF node to look for the value. But when dragging in the array it only looks for the 0 item of the array. I want to look at all the items.

{{ $json["tags"]["0"]["tag"] }}

That expression only looks at item 0 for the match. How can I get it to look through all the items? The exact number of items will vary each time.

The ultimate goal to stop the workflow to continue if a particular tag is present.

you would probably need to split the tags list with the itemlists node and then use the IF node after that.

1 Like

alternatively you can write a simple javascript include function to lookup an item in an array this can be used directly in the if node as an expression or as an independent node.

return $node["nameOfNode"]["arrayOfValues"].includes("thingYouAreSearching");

using the new code node, how would someone search through an entire nested array to find a specific key pair or a specific string. cant keep splitting that use itemlists, need code to search the entire result.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.