# Filter collection by: json object - contains - array?

**URL:** <https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142>\
**Category:** How do I?\
**Created:** [February 20, 2024, 7:13pm UTC](https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142 "2024-02-20T19:13:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robyn](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Robyn](https://community.weweb.io/u/Robyn)\
**Post date:** [February 20, 2024, 7:13pm UTC](https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142/1 "2024-02-20T19:13:07Z")

</div>

Hello,

Im currently working with a collection which i need to filter by a product\_id’s (use case - to show users favourited items).

I have a colletion from API call where the “product\_id” is under the json object named “source” (as seen in the screenshot below) but when im trying to filter the collection it only let me choose “source” as whole - nothing else/underneath it. So right now im trying to filter the json object named “source” of the collection by checking if it contains an array of “product\_id” but so far i had zero luck doing so.

May i ask what would be a proper way of achieving this?  
Any kind of advice is welcomed:)!

 ![filter_collections](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/af21e68416df06e8b3d44e4ea5cc432b19835bb8.jpeg)  
 ![My collection-screen](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/cb70c0d5178765b64f98bc8f1385c9b4324c1965.jpeg)

---

<div class="post-metadata">

**Author:** ![Robyn](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Robyn](https://community.weweb.io/u/Robyn)\
**Post date:** [February 24, 2024, 3:20pm UTC](https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142/2 "2024-02-24T15:20:09Z")

</div>

Hello, still wondering if this is might be doable somehow?🙂

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [February 24, 2024, 3:38pm UTC](https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142/3 "2024-02-24T15:38:35Z")

</div>

Hello, it’s currently not possible, you could do this inside a formula and bind result of that formula instead of the apify data

---

<div class="post-metadata">

**Author:** ![Robyn](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Robyn](https://community.weweb.io/u/Robyn)\
**Post date:** [February 24, 2024, 5:06pm UTC](https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142/4 "2024-02-24T17:06:35Z")

</div>

Thank you for your reponse!

Do you think you could elaborate little on the “formula” - how could that specific formula look like?

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [February 24, 2024, 6:00pm UTC](https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142/5 "2024-02-24T18:00:35Z")

</div>

You would need to go to Actions → Formulas → Create  
Then you would do some logic to filter an array based on your choosen conditions, and use that formula to “filter” your collection.

---

<div class="post-metadata">

**Author:** ![felipegranado](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/felipegranado/32/6306_2.png) [@felipegranado](https://community.weweb.io/u/felipegranado)\
**Post date:** [February 25, 2024, 2:05am UTC](https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142/6 "2024-02-25T02:05:11Z")

</div>

I see the Data type are different (text and integer)… Try use toNumber() formula to set the ID text to number, or toText() to set the ID integer to text…

---

<div class="post-metadata">

**Author:** ![Robyn](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Robyn](https://community.weweb.io/u/Robyn)\
**Post date:** [February 25, 2024, 4:06pm UTC](https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142/7 "2024-02-25T16:06:29Z")

</div>

Thank you so much, both of you, by combining these two tips i have kinda make it work! Appreciate it.

---

<div class="post-metadata">

**Author:** ![garcilaso](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/garcilaso/32/11683_2.png) [@garcilaso](https://community.weweb.io/u/garcilaso)\
**Post date:** [June 24, 2024, 11:04am UTC](https://community.weweb.io/t/filter-collection-by-json-object-contains-array/7142/8 "2024-06-24T11:04:15Z")

</div>

Hi @Robyn, would it be possible to share how you built it?

Thank you!
