Need to remove backslashes from json value
Just use the stripslashes function
return $this->output->set_output(stripslashes(json_encode($responseData,JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)));
try trim function
$responseData = array("status" => 'ok',"categories" => trim($category_res),"products" => trim($product_res),"search_count" => $search_count, "Response" => array("response" => "Success", "response_code" => 1));