Skip to content Skip to sidebar Skip to footer

Json Exception In Android

I am trying to execute query on database in the localhost and send the JSON object to the client in android. I m not been able to know what is the problem in my code. So some one p

Solution 1:

Probably you cannot do this

Strings= e.getString("post");

because there is no "post" key in the array of Strings you have given,...

Try doing this,

Strings= e.has("post")?e.getString("post"):null;

and then on next line keep a null check before Creating JSONObject..

Solution 2:

Try this

$posts['data'] = $post;
//echo "SUCCESS";
header('Content-type: application/json');
echo json_encode($posts);

Post a Comment for "Json Exception In Android"