How do I filter array based on other array in Groq

74 Views Asked by At

My sanity data structure looks like this and I want to select this based on selected language ('nl' or 'en').

code

But the point is that it is in a separate object like zero and first index. How can I make it reusable to filter through all nested objects and checks the language.

*[_type == "banner"]
0:{…} 10 properties
  sideTitle:[…] 2 items
  0:{…} 3 properties
    _type:internationalizedArrayStringValue
    _key:nl
    value:Service
  1:{…} 3 properties
    value:Service
    _type:internationalizedArrayStringValue
    _key:en

I tried to find the index but it is not very reusable in this case, because there is always an zero and first index.

0

There are 0 best solutions below