Only store keys with specific values from json data in php [duplicate]

[{
“service”: “abc”,
“capability”: “s”
},
{
“service”: “def”,
“capability”: “s”
},
{
“service”: “abc”,
“capability”: “v”
},
{
“service”: “def”,
“capability”: “v”
}
]

The api data is returned with capability key and I want that only the data where capability is equal to s should be stored. Whats the best way to do this?
Also I need to show this on the table in html page is it better to do this in php or javascript?

$array = array();
    foreach($jsonarray as $key=>$item) {
    if($key=>$item == "s"){
    $array = array(
    "service" => "",
    "capability" => "",
);
}

If the value of capability = s then only store the data ignore the one with the value v.

With array filter it returns empty array r

$r=array_filter($json_array_list, function($capability, $value) {
      return $capability == "sms";
    }, ARRAY_FILTER_USE_BOTH);
    print_r($r);