-1
雖然在我的Android應用程序從服務器解析JSON數據,我得到以下錯誤:錯誤在我的Android應用程序解析JSON
org.json.json exception value <html><head><title>Apache of type java.lang.String cannot conveted to JSONObject
有誰知道是什麼引起的問題?
雖然在我的Android應用程序從服務器解析JSON數據,我得到以下錯誤:錯誤在我的Android應用程序解析JSON
org.json.json exception value <html><head><title>Apache of type java.lang.String cannot conveted to JSONObject
有誰知道是什麼引起的問題?
您得到的錯誤是JSONException
。據json.org的JSON in Java(因爲的Javadoc不是有用):
A JSONException is thrown when a syntax or procedural error is detected.
你試圖解析的數據是JSON format的不是。它看起來像是HTML。這可能是因爲你查詢了一個無效的url,它將返回一個錯誤頁面,而不是你期望的JSON。
的JSON對象應該是這樣的:
{
"foobar": "some value here",
"bla": "maybe another thing here",
"sub-document": {
"whatever": "lorem ipsum"
}
}
檢查你正在迴響應。 「