@SempervivumJun 03.2022 — #I didn't reflect about what the result of your return statement is, but recommend to do it like this instead: ``<i> </i>return data.status_id == 2 || data.status_id == 3;<i> </i>`</CODE>
In case there are many values to check, using an array might be smarter: <CODE>`<i> </i> let result4 = JSON.parse(json).filter(function (data) { const toMatch = [2, 3]; return toMatch.includes(data.status_id); });<i> </i>``
@bwclovisJun 03.2022 — #If you know the array will ALWAYS be 3, or at most you will always want to return all but the1st one (in your case 'active'), you could also flip the logic:
let result = JSON.parse(json).filter((data) => (<br/> data.status_id !== 1<br/> ));
If the array is dynamic in nature, than Sempervivum's answer is really nice.
@SempervivumJun 06.2022 — #Simply hand over the array to the function as a parameter: ``<i> </i> function filterIt(json, toMatch) { return JSON.parse(json).filter(function (data) { return toMatch.includes(data.status_id); }); }