To convert json data to a PHP array, all that is needed is to use the second parameter of the json_decode function. Likely one of the first problems that many will run into, is that when they use json_decode without the second parameter – maybe not knowing its there. Without using it. json_decode will just return stdClass objects. To avoid this problem entirely, the second parameter can be set to true, which will return a PHP array, as many will expect it to.
Using json decode to return PHP array
The below example shows how to return a normal PHP array, rather than the default stdclass object.
<?php $New_array = json_decode($json_data, true); ?>
If for some reason this does not work, your json encoded data is likely invalid.