<?php
include 'konak.php';
$query = "SELECT servicename, harga, serviceid FROM price";
$data  = mysqli_query($koneksi, $query);
$res = [];
while ($row = $data->fetch_assoc()) {
    $key = $row["servicename"];
    $res[$key] = [
        "harga"    => (double)$row["harga"],
        "serviceid" => $row["serviceid"]
    ];
}

header('Content-Type: application/json');
echo json_encode($res);
die();
?>
