使用php,JSON响应不如预期

I know this is probably a really simple question, but I can't find an answer for this issue, maybe because it is a really basic php programming question. This is my function using PDO (php):

<?php
function getAllUsers(){
    try {
        $conn = getConnection(); //connects to database, no explanation needed... uses PDO
        $dbh = $conn->prepare("SELECT * FROM User;");
        $dbh->execute();

        $users = $dbh->fetchAll(); //<---this is maybe the error

        $conn = null;
        return $users;
    }catch (PDOException $ex){
        echo "Error: ".$ex->getMessage();
    }
} ?>

And when i consume the API that i'm implementing, i use this other PHP script (using slim framework, still pretty understandable)

<?php
$app->get("/user",function() use($app){

    $app->response->headers->set("Content-type","application/json");
    $app->response->status(200);
    $result = getAllUsers(); //call to my function getAllUsers
    $app->response->body(json_encode($result));
});
?>

It works fine, but the results that I get are these:

[{"idUser":"1","0":"1","userName":"asdasd","1":"asdasd","userPass":"password","2":"password"},{"idUser":"2","0":"2","userName":"2312","1":"2312","userPass":"password","2":"password"}]

And I think that the repeated values "0":"1" , "1":"asdasd" , "2":"password"should not be there, but i can't figure out how to get only the data that i want and not the repeated values. Any help would be very appreciated

I'm not using PDO, but "common" mysql queries and there is the same...you get doubled your values. One array is associative and other indexed (0,1,2). And there is option to pass ("MYSQL_ASSOC" if I recall well) to get only associative array, without indexed one. There must be some similar option with PDO.

$dbh->fetchAll(PDO::FETCH_ASSOC);

http://php.net/manual/en/pdostatement.fetchall.php