I got this JSON which I need to convert to associative PHP array
[
{
"32": {
"name": "Price File Jan 2022.xlsx",
"datastartingrow": "1"
}
},
{
"33": {
"name": "Price File Feb 2022.xlsx",
"datastartingrow": "2"
}
}
]
$decoded = json_decode($json, true)
creates unnecessary arrays [0] and [1], so I can't access $decoded[32] without double looping.
Array
(
[0] => Array
(
[32] => Array
(
[name] => Price File Jan 2022.xlsx
[datastartingrow] => 1
)
)
[1] => Array
(
[33] => Array
(
[name] => Price File Feb 2022.xlsx
[datastartingrow] => 2
)
)
)
Is there an elegant way of accessing each array by using key [32] and [33]?
Thanks.