Jsonexception: Value
Guys can you help me a little bit, Im getting this error: 'JSONException: Value Solution 1:
This issue comes from the server.
The URL you're requesting, send you back data but not in the JSON format.
The Exception you get is telling you that the String the server send you back starts with:
<!DOCTYPE
This can be:
- A simple webpage (instead of raw JSON). It correspond to the first XML tag of a web page (source)
- An error page generated by the server, and printed in HTML
To debug this further, simply print the content of your json
variable in the logcat:
Log.d("Debug", json.toString());
jObj = newJSONObject(json);
Solution 2:
This problem came in my code also.and solution was different.It occured due to spelling mistake of webservice.
Solution 1:
for example real the url is
http://example.com/directory/file.php
and i had used
http://example.com/directory/file1.php
Solution 2:
use loopj library .it exactly gives you the explained error.
AsyncHttpClientclient=newAsyncHttpClient();
client.post(str , localRequestParams, newAsyncHttpResponseHandler() {
@OverridepublicvoidonFinish() {
super.onFinish();
Log.i("onFinish","onFinish");
}
@OverridepublicvoidonSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Log.i("onSuccess","onSuccess");
}
@OverridepublicvoidonFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Log.i("onFailure","onFailure");
}
});
Guys can you help me a little bit, Im getting this error: 'JSONException: Value
Solution 1:
This issue comes from the server. The URL you're requesting, send you back data but not in the JSON format. The Exception you get is telling you that the String the server send you back starts with:
<!DOCTYPE
This can be:
- A simple webpage (instead of raw JSON). It correspond to the first XML tag of a web page (source)
- An error page generated by the server, and printed in HTML
To debug this further, simply print the content of your json
variable in the logcat:
Log.d("Debug", json.toString());
jObj = newJSONObject(json);
Solution 2:
This problem came in my code also.and solution was different.It occured due to spelling mistake of webservice.
Solution 1:
for example real the url is
http://example.com/directory/file.php
and i had used
http://example.com/directory/file1.php
Solution 2: use loopj library .it exactly gives you the explained error.
AsyncHttpClientclient=newAsyncHttpClient();
client.post(str , localRequestParams, newAsyncHttpResponseHandler() {
@OverridepublicvoidonFinish() {
super.onFinish();
Log.i("onFinish","onFinish");
}
@OverridepublicvoidonSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Log.i("onSuccess","onSuccess");
}
@OverridepublicvoidonFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Log.i("onFailure","onFailure");
}
});
Post a Comment for "Jsonexception: Value