這是我的PHP請求:如何在ANDROID中使用JSON?
<?php
// parametri del database
$db_host = "localhost";
$db_user = "unisadb";
$db_password = "";
$db_name = "my_unisadb";
$db = mysql_connect($db_host, $db_user1, $db_password);
if ($db == FALSE)
die ("Errore nella connessione. Verificare i parametri...");
mysql_select_db($db_name, $db)
or die ("Errore nella selezione del database. Verificare i parametri...");
$q = mysql_query("SELECT * FROM Utente");
while($e=mysql_fetch_assoc($q))
$output[]=$e;
print(json_encode($output));
mysql_close();
?>
,這是JSON響應
[
{
"idUtente": "1",
"Nome": "Roberto",
"Cognome": "D'Antuono",
"Valutazione": "0"
},
{
"idUtente": "2",
"Nome": "Luca ",
"Cognome": "Carbone",
"Valutazione": "90"
}
]
你能幫我一個指南或順序「如何」通過這個JSON獲取數據?
顯示代碼你試圖解析發佈的json。因爲json很容易將你發佈的問題解析出來 –