Filter an API response without query params

I struggle to filter an API JSON response by a key->value.

I fetch the API containing about 3000 instances, and I struggle to get the filtering functionality working. Example response:

"name": "Rolex",
"id": "123",
"type": "Expensive",
"image": "imgURL1"
"name": "Omega",
"id": "456",
"type": "Cheap",
"image": "imgURL2"

How can I filter the data by value field “type”->contains/includes/equals->Cheap”?

I cannot manipulate the primary response since I’d like to filter this differently on the same page. The plugIn Simple Filter doesn’t seem to work either… I’m doing something stupid wrong here…

This is pretty simple to achieve in PHP or JS code (NUXT code):

watchesValue.value = filteredWatches.filter(watches => watches.type?.includes('Cheap'));

I tried to figure it out for a few days but realized I needed help getting this running. Or maybe this have to be done in “Custom Code”…

Any help to point me in the right direction is much appreciated :pray:t3:

I would say best option in this case is to filter it using JavaScript. But that’s not yet supported in Divhunt for source, if you have 1-2 days, I can make functionality for it and record video how you can achieve this.

1 Like

Thanx @dejan .

Just to clarify, the builder has access to the data and I can use “Visibility Condition” to “filter” the data (on child div/card) but that obviously presents other issues with empty divs from parent GET request, it seems Conditions can only be applied AFTER the data is fully fetched (which kind of makes sense):

Visilibility Conditions:
Frame 8


Yeah I know, don’t worry. Work on something else until I get back to you soon :smiley:

1 Like

I have tons of work coming up so that’s no worries but almost all include some manipulation of APIs. No stress @dejan :slight_smile:

1 Like