hey every one thank you in advance
i have a jason resonse befofe the start of the json respone i get a hyphen like this
i have been stuck for a day here so any help is much appreciated
-{
"responseCode": "",
"responseStatus": "200",
"responseMessege": "Success",
"product": {
"id": "60",
"name": "Rolex Watch",
"description": "Luxury watch.",
"price": "25000",
"category_id": "1",
"category_name": "Fashion"
}
}
the json encode part
if($product->name!=null){
// create array
$product_arr = array(
"id" => $product->id,
"name" => $product->name,
"description" => $product->description,
"price" => $product->price,
"category_id" => $product->category_id,
"category_name" => $product->category_name**Bold Text Here**
);
// set response code - 200 OK
http_response_code(200);
// make it json format
echo json_encode(
array(
"responseCode"=>"",
"responseStatus"=>"200",
"responseMessege"=>"Success",
"product"=>$product_arr));
}