Answer the question
In order to leave comments, you need to log in
Where does the extra nesting come from when decoding JSON into a PHP array?
There is JSON:
$cats_price = '[{"kurtki-i-palto-zimnie-muzhskie":40},{"dublenki-iz-naturalnoj-ovchiny-muzhskie":40}]';
json_decode($cats_price, true);
I distill into an array, the output is:array(2) {
[0]=>
array(1) {
["kurtki-i-palto-zimnie-muzhskie"]=>
int(40)
}
[1]=>
array(1) {
["dublenki-iz-naturalnoj-ovchiny-muzhskie"]=>
int(40)
}
}
Array(
"kurtki-i-palto-zimnie-muzhskie"=> 40,
"dublenki-iz-naturalnoj-ovchiny-muzhskie"=> 40
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question