console.log(typeof data)
выводит string. $app->get('/api/customers', function(Request $request, Response $response){
$sql = "SELECT * FROM customers";
try{
// Get DB Object
$db = new db();
// Connect
$db = $db->connect();
$stmt = $db->query($sql);
$customers = $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
return $response->withJson($customers);
} catch(PDOException $e){
echo '{"error": {"text": '.$e->getMessage().'}';
}
});