I am integrating code below
$data[] = array('id'=>$id);
$data[] = (object) [ "first_name"=> "John", "last_name"=> "Doe"];
$final_result = array('result'=> $data);
print json_encode($final_result);
I am getting response like this in api
"result": [
{
"id": "1",
},
{
"first_name": "John",
"last_name": "Doe",
}
]
but I want it to look like below
"result": [
{
"id": "1",
},
"emp_info": {
"first_name": "John",
"last_name": "Doe",
}
]
how can I do that ?