Ciao a tutti
Stoa vendo un problemino con la creazione di dati JSON questo è il code:

Codice PHP:
$data = [];    $markets = [];    if(!$query || mysqli_num_rows($query) == 0){        $data = ["esito" => "ko"];    } else {        $data = ["esito" => "OK"];    }
    
$fileds = [];    while($row mysqli_fetch_row($query)){       $fields = [            "ID" => $row[0],            "lat" => $row[1],            "lng" => $row[2]        ];        array_push($markets$fields);    }

    
array_push($data, ["markets" => $markets]); 
il risultato è questo:

{"esito":"OK","0":{"markets":[{"ID":"414135326422362636237357272575","lat":"41.8 896625","lng":"12.466928"},{"ID":"6327357257572577 33727375725572","lat":"41.9008196","lng":"12.49146 45"}]}}

Il problema e che dove sta "0" (zero) dovrebbe starci "markets"
Come mai mi da la key = e non markets?