In this service I am getting output but I want different output. Let me explain:
$customer_id = $_POST['customer_id'];
$response = array();
$qry="SELECT category FROM nesbaty_customer where c_id='".$customer_id."' ";
$qry_res=mysqli_query($con,$qry);
$jsonData = array();
while ($array = mysqli_fetch_assoc($qry_res))
{
$r= $array['category'];
$jsonData[]=explode(",",$r);
}
echo json_encode(array('data' =>$jsonData));
mysqli_close($con);
I am getting Output like this:
{
"data": {
"category": [
"Hotel",
"Saloon"
]
}
}
But I want output like this!
{"data":[{"category":"Hotel"},{"category":"Saloon"}]}