PHP Json Encode multidimension array

Viewed 12

I have a PHP script which I use to dynamically create a JSON result of a users details like name and serial like the example below. This script is then called by my python script which is running on a raspberry pi. It works great as it was originally designed to return one user and the python script is able to read that.

I now need the ability for the PHP json array to return the same data set for multiple users. How can I make the json data array so that i can loop through each users data set

$json_data = array(
"code"=>"200",
"name"=>"My Name",
"serial_number"=>"serial"
);

$result =  json_encode($json_data);
0 Answers
Related