I have a category Table. I want to get all these data of the category table but the API response coming back with a backslash. How to avoid this backslash.
public function category_get($id = 0) {
$categories = $this->category_model->getRows($id);
// Check if the user data exists
if(!empty($categories)){
// Set the response and exit
//OK (200) being the HTTP response code
$this->response($categories, REST_Controller::HTTP_OK);
}else{
// Set the response and exit
//NOT_FOUND (404) being the HTTP response code
$this->response([
'status' => FALSE,
'message' => 'No category was found.'
], REST_Controller::HTTP_NOT_FOUND);
}
}
{
"category_id": "27",
"category_name": "Household",
"description": null,
"digital": null,
"banner": "category_27.jpg",
"data_brands": "",
"data_vendors": "",
"subcategories": "[{\"sub_id\":\"121\",\"sub_name\":\"DABUR RED AYURVEDIC TOOTHPASTE 100GM\",\"min\":50,\"max\":50,\"brands\":\"\"},{\"sub_id\":\"122\",\"sub_name\":\"Toilet Cleaner\",\"min\":82,\"max\":82,\"brands\":\"\"},{\"sub_id\":\"123\",\"sub_name\":\"Agarbatti & Puja Essentials \",\"min\":120,\"max\":120,\"brands\":\"\"},{\"sub_id\":\"135\",\"sub_name\":\"toothpaste\",\"min\":80,\"max\":80,\"brands\":\"\"},{\"sub_id\":\"144\",\"sub_name\":\"deo\",\"min\":0,\"max\":0,\"brands\":\"\"}]"
},