3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[{ "image": "/b/l/black_10.jpg" }, { "url_key": "printing-products" }, { "position_back": "251,252" }]'; //Using json_decode convert json into array $array = json_decode($json, true); array_walk_recursive($array, function($item, $key) use (&$final_array){$final_array[$key]=$item;}); //Convert into json format echo json_encode($final_array); echo "<pre>"; print_r($final_array); ?>
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
{"image":"\/b\/l\/black_10.jpg","url_key":"printing-products","position_back":"251,252"}<pre>Array ( [image] => /b/l/black_10.jpg [url_key] => printing-products [position_back] => 251,252 )

preferences:
133.61 ms | 408 KiB | 5 Q