Ich denke, der richtige Weg, dies zu tun, wäre:
$json = array();
$result = mysqli_query ($connection, $query);
while($row = mysqli_fetch_array ($result))
{
$bus = array(
'latitude' => $row['lat'],
'longitude' => $row['lng'],
'icon' => './images/' . $row['busColor'] . '.png'
);
array_push($json, $bus);
}
$jsonstring = json_encode($json);
echo $jsonstring;
die();