php pdo 获取数据转换为json

php 查询语句获取数据,数据库有好多表现形式,如何拿出自己需要的数据

$raceSQL ='select id, race_name,race_code,content from je_race ';

$pdoStatement = $db->query ($raceSQL);

$Races = json_encode ( $pdoStatement->fetchAll());

print $Races;

responseText: "[{"id":"4","0":"4","race_name":"renl","1":"renl","race_code":"s","2":"s","content":"","3":""]"

如何去掉不需要的表现形式

$Races = json_encode ( $pdoStatement->fetchAll(PDO::FETCH_ASSOC));

responseText: "[{"id":"4","race_name":"renl","race_code":"s","content":""},{"id":"5","race_name":"2321","race_code":"d","content":""}]"

json_encode:php 内把数据转换为json字符串