Array Intersection

Find common elements that exist in both arrays.

Code

General
echo "$arr1" | jq --argjson b "$arr2" '[.[] | select(. as $x | $b | index($x))]'

Parameters

First JSON array

Second JSON array

Server

More Bash Snippets