json - How to check if element exists in array with jq -


i have array , need check if elements exists in array or element array using jq, fruit.json:

{     "fruit": [         "apple",          "orange",         "pomegranate",         "apricot",         "mango"     ] }   cat fruit.json | jq '.fruit .apple'  

does not work

cat fruit.json | jq '.fruit' | jq 'contains(["orange"])'


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -