Posted by & filed under JSON, PHP.

To convert a JSON array into a PHP array, use the following script:

<?php
$json = file_get_contents('json/yourscript.json'); // Get the JSON data
$phpObj = json_decode($json,true);  // Convert to PHP Object
print_r($phpObj);  // Convert to PHP Array
?>

file_get_contents('json/yourscript.json'); Allows you to get the JSON data easily.

json_decode($json,true); Is a PHP function that converts your JSON data into a PHP Object.

print_r(); Will change the PHP object into a PHP readable array.