Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

Finding if each element of array 1 exists in array 2

$
0
0

I have 2 json files: a_names.json and b_names.json.File a:

{"Names": ["a","b","c"]}

File b:

{"Names": ["b","c"]}

What i tried to do was (say i have a loop with counter ascending from 0):a_names.Names | contains([b_names.Names[.counter]])And the output is an error: Cannot index string with string.However, next code provides a proper boolean output:a_names.Names | contains(["b"])My colleague said it's happening due to me trying to refer to array 2 while being inside of the array 1, but we can't find a solution.

P.S. - Same happens with any other "search" function, such as "any","IN", etc...


Viewing all articles
Browse latest Browse all 657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>