目前我只能夠實際讀取包含json格式的php文件。如何從Android中讀取回聲聲明
我想要做的是閱讀的回聲聲明(JSON格式),在替換的讀取實際文件。
這是我的Android代碼,到目前爲止,請求包含一個JSON格式的PHP文件給我讀:提前
// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent(); // This is storing the contents from the php file
由於這是php文件:
{
"user": [
{
"id": "001",
"name": "Raj Amal",
"email": "[email protected]"
}
]
}
I want to do this:
<?php
echo '{
"user": [
{
"id": "001",
"name": "Raj Amal",
"email": "[email protected]"
}
]
}';
?>
這不是很清楚,我你的要求 - 什麼是你所得到的迴應,爲什麼不能你看了嗎?你需要解析JSON還是什麼? – ajshort