I have the following php code that produces a json data set
$json_data = array(
"code"=>"200",
"name"=>"My Name",
"serial_number"=>"serial"
);
$result = json_encode($json_data);
The dataset is only one level. As I am creating this data set with a php loop. I want to be able to have multiple people but the code element be outside the users. So basically I want the json data to look like this:
{
"code": "404",
"people": [
{
"name": "Person 1",
"serial_number": "xyz"
},
{
"name": "Person Two",
"serial_number": "123"
}
]
}