What is the convenient way to convert objects to arrays
Original data
$data = {
"1": {
"id": 1,
"name": "超市类",
"pid": 0,
},
"3": {
"id": 3,
"name": "餐饮类",
"pid": 0,
},
"4": {
"id": 4,
"name": "造型类",
"pid": 0,
},
}
Target Result
$data = [{
"id": 1,
"name": "超市类",
"pid": 0,
},{
"id": 3,
"name": "餐饮类",
"pid": 0,
},{
"id": 4,
"name": "造型类",
"pid": 0,
}]
I think the original data is json, so
A very stupid method (array)$data, this actually works too