i have this output of json :
{
"value": [
{
"vm": "vm-1060",
"name": "node10",
"cpu_count": 16
},
{
"vm": "vm-1063",
"name": "node2",
"cpu_count": 16
},
{
"vm": "vm-1064",
"name": "node0",
"cpu_count": 16
}
]
and i want to list (or select) all available value's named "vm" automatically , not manual selecting ! because my json outputs are variable
CodePudding user response:
You can use next simple code:
$arr = json_decode($json, true);
$values = array_column($arr['value'], 'vm');