You can use your code in this way as follows:
$number)
{
$numbers[$i] = number_format($number, 2, '.', null);
}
echo $res = json_encode($numbers); // ["1.00","2.00"]
echo str_replace('"', '', $res); //[1.00,2.00]
?>
and Your EXPECTED OUTPUT: [1.00,2.00] which is same.