title: value <br of type java.lang.String cannot be converted to JSONObject In Android Programming
body: <p>When I am Create new Android Application to Fetch data from my server like xampp, But Its not Retrieval and i am using catch statement for itz exception then it says as JSONObject cannot convert it, How to Solve?</p>
  
  <p>Solution for this, Please Help me?
  Thanks in Advance</p>
  
  <p>My Full Java Code</p>
  
  <pre><code>   package com.example.fetch;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import org.apache.http.NameValuePair;
  import org.apache.http.client.ResponseHandler;
  import org.apache.http.client.entity.UrlEncodedFormEntity;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.impl.client.BasicResponseHandler;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.message.BasicNameValuePair;
  import org.json.JSONArray;
  import org.json.JSONObject;
  
  
  import android.app.Activity;
  import android.content.SharedPreferences;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.TextView;
  import android.widget.Toast;
  
  
  public class Disp extends Activity {
      TextView user,email,phone;
      String abdu,hos,em,ph;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.disp);
          user=(TextView)findViewById(R.id.user);
          email=(TextView)findViewById(R.id.email);
          phone=(TextView)findViewById(R.id.phone);
          SharedPreferences sandra=getApplicationContext().getSharedPreferences("veena", MODE_WORLD_READABLE);
          abdu=sandra.getString("shyma", "");
          user.setText(abdu);
          aji aj=new aji();
          aj.execute();
      }
      class aji extends AsyncTask&lt;Void, Void, Void&gt;
      {
  
          @Override
          protected Void doInBackground(Void... arg0) {
              // TODO Auto-generated method stub
              try
              {
                  DefaultHttpClient hc=new DefaultHttpClient();
                  ResponseHandler&lt;String&gt; res=new BasicResponseHandler();
                  HttpPost postMethod=new HttpPost("http://10.0.2.2/std/ret.php");
                  List&lt;NameValuePair&gt;nameValuePairs=new ArrayList&lt;NameValuePair&gt;(1);
                  nameValuePairs.add(new BasicNameValuePair("username",abdu));
                  postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                   hos = hc.execute(postMethod,res);
                   System.out.println(hos);
  
              }
              catch(Exception e)
              {
                  System.out.println("Error:"+e);
                  Log.e("Fail 1", e.toString());
                  Toast.makeText(getApplicationContext(), "Invalid Login",
                          Toast.LENGTH_LONG).show();
  
              }
              return null;
          }
          @Override
          protected void onPostExecute(Void result) {
              // TODO Auto-generated method stub
              super.onPostExecute(result);
              parsingmethod();
          }
      }
  
  
  
      public void parsingmethod()
      {
          try
          {
              JSONObject jobject=new JSONObject(hos);
              JSONObject jobject1=jobject.getJSONObject("Event");
              JSONArray ja=jobject1.getJSONArray("Details");
              int length=ja.length();
              for(int i=0;i&lt;length;i++)
              {
                  JSONObject data1=ja.getJSONObject(i);
  
                  em=data1.getString("email");
                  ph=data1.getString("pass");
  
                  System.out.println(em+ph);
                  email.setText(em);
                  phone.setText(ph);
  
              }
          }
          catch(Exception e)
          {
              /*System.out.println("error:"+e);
              Log.e("Fail 2", e.toString());
              Toast.makeText(getApplicationContext(), "Invalid IP Address",
                      Toast.LENGTH_LONG).show();*/
              e.printStackTrace();
              displayExceptionMessage(e.getMessage());
          }
          }
  
  
  
      private void displayExceptionMessage(String message) {
          // TODO Auto-generated method stub
          Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
      }
      }
  </code></pre>
  
  <p>Catch Exception Shows that value 
  
  <p>My Log Cat</p>
  
  <pre><code>01-20 16:22:31.432: I/System.out(10797): Error:org.apache.http.conn.HttpHostConnectException: Connection to http://localhost refused
  01-20 16:22:31.452: I/System.out(10797): error:java.lang.NullPointerException
  01-20 16:24:01.342: I/System.out(10996): error:org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 16:44:57.302: I/System.out(11503): error:org.json.JSONException: No value for Event
  01-20 16:50:19.062: I/System.out(11741): error:org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 16:50:59.572: I/System.out(11960): error:org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 16:50:59.572: E/Fail 2(11960): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 16:51:26.462: I/PGA(12155): New SOCKET connection: m.example.fetch (pid 12155, tid 12155)
  01-20 16:51:29.142: I/System.out(12155): error:org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 16:51:29.142: E/Fail 2(12155): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 16:51:49.742: I/System.out(12347): error:org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 16:51:49.742: E/Fail 2(12347): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 16:52:11.062: I/System.out(12540): error:org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 16:52:11.062: E/Fail 2(12540): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:05:45.082: W/System.err(13814): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:05:45.082: W/System.err(13814):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:05:45.082: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
  01-20 17:05:45.082: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
  01-20 17:05:45.082: W/System.err(13814):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:05:45.082: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:05:45.082: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:05:45.082: W/System.err(13814):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:05:45.082: W/System.err(13814):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:05:45.082: W/System.err(13814):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:05:45.082: W/System.err(13814):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:05:45.082: W/System.err(13814):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:05:45.082: W/System.err(13814):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:05:45.082: W/System.err(13814):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:05:45.082: W/System.err(13814):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:05:45.082: W/System.err(13814):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:05:45.082: W/System.err(13814):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:05:45.082: W/System.err(13814):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:05:51.882: W/System.err(13814): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:05:51.882: W/System.err(13814):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:05:51.882: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
  01-20 17:05:51.882: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
  01-20 17:05:51.892: W/System.err(13814):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:05:51.892: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:05:51.892: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:05:51.892: W/System.err(13814):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:05:51.892: W/System.err(13814):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:05:51.892: W/System.err(13814):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:05:51.892: W/System.err(13814):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:05:51.892: W/System.err(13814):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:05:51.892: W/System.err(13814):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:05:51.892: W/System.err(13814):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:05:51.892: W/System.err(13814):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:05:51.892: W/System.err(13814):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:05:51.892: W/System.err(13814):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:05:51.892: W/System.err(13814):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:06:26.712: W/System.err(13814): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:06:26.712: W/System.err(13814):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:06:26.712: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
  01-20 17:06:26.712: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
  01-20 17:06:26.712: W/System.err(13814):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:06:26.712: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:06:26.712: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:06:26.712: W/System.err(13814):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:06:26.712: W/System.err(13814):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:06:26.712: W/System.err(13814):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:06:26.712: W/System.err(13814):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:06:26.712: W/System.err(13814):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:06:26.712: W/System.err(13814):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:06:26.712: W/System.err(13814):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:06:26.712: W/System.err(13814):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:06:26.712: W/System.err(13814):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:06:26.712: W/System.err(13814):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:06:26.712: W/System.err(13814):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:07:20.232: W/System.err(13814): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:07:20.242: W/System.err(13814):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:07:20.242: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
  01-20 17:07:20.242: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
  01-20 17:07:20.242: W/System.err(13814):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:07:20.242: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:07:20.242: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:07:20.242: W/System.err(13814):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:07:20.242: W/System.err(13814):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:07:20.242: W/System.err(13814):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:07:20.242: W/System.err(13814):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:07:20.242: W/System.err(13814):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:07:20.242: W/System.err(13814):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:07:20.242: W/System.err(13814):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:07:20.242: W/System.err(13814):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:07:20.242: W/System.err(13814):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:07:20.242: W/System.err(13814):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:07:20.242: W/System.err(13814):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:07:40.612: W/System.err(13814): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:07:40.612: W/System.err(13814):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:07:40.612: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
  01-20 17:07:40.612: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
  01-20 17:07:40.612: W/System.err(13814):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:07:40.612: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:07:40.612: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:07:40.612: W/System.err(13814):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:07:40.612: W/System.err(13814):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:07:40.612: W/System.err(13814):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:07:40.612: W/System.err(13814):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:07:40.612: W/System.err(13814):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:07:40.612: W/System.err(13814):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:07:40.612: W/System.err(13814):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:07:40.612: W/System.err(13814):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:07:40.612: W/System.err(13814):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:07:40.612: W/System.err(13814):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:07:40.612: W/System.err(13814):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:11:44.152: W/System.err(13814): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:11:44.152: W/System.err(13814):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:11:44.162: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
  01-20 17:11:44.162: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
  01-20 17:11:44.162: W/System.err(13814):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:11:44.162: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:11:44.162: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:11:44.162: W/System.err(13814):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:11:44.162: W/System.err(13814):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:11:44.162: W/System.err(13814):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:11:44.162: W/System.err(13814):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:11:44.162: W/System.err(13814):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:11:44.162: W/System.err(13814):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:11:44.162: W/System.err(13814):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:11:44.162: W/System.err(13814):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:11:44.162: W/System.err(13814):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:11:44.162: W/System.err(13814):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:11:44.162: W/System.err(13814):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:12:13.872: E/dalvikvm(13814): No JIT support for bytecode f0 at offsetPC 0
  01-20 17:12:13.872: E/dalvikvm(13814): JIT implementation not found
  01-20 17:12:13.872: I/dalvikvm(13814): codeGenBasicBlockJit returns negative number
  01-20 17:12:13.892: W/System.err(13814): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:12:13.892: W/System.err(13814):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:12:13.892: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
  01-20 17:12:13.892: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
  01-20 17:12:13.892: W/System.err(13814):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:12:13.892: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:12:13.892: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:12:13.892: W/System.err(13814):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:12:13.892: W/System.err(13814):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:12:13.892: W/System.err(13814):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:12:13.892: W/System.err(13814):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:12:13.892: W/System.err(13814):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:12:13.892: W/System.err(13814):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:12:13.892: W/System.err(13814):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:12:13.892: W/System.err(13814):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:12:13.892: W/System.err(13814):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:12:13.892: W/System.err(13814):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:12:13.892: W/System.err(13814):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:13:12.522: W/System.err(13814): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:13:12.522: W/System.err(13814):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:13:12.522: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
  01-20 17:13:12.522: W/System.err(13814):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
  01-20 17:13:12.522: W/System.err(13814):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:13:12.522: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:13:12.522: W/System.err(13814):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:13:12.522: W/System.err(13814):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:13:12.522: W/System.err(13814):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:13:12.522: W/System.err(13814):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:13:12.522: W/System.err(13814):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:13:12.522: W/System.err(13814):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:13:12.522: W/System.err(13814):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:13:12.522: W/System.err(13814):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:13:12.522: W/System.err(13814):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:13:12.522: W/System.err(13814):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:13:12.522: W/System.err(13814):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:13:12.522: W/System.err(13814):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:19:47.832: I/PGA(14194): New SOCKET connection: m.example.fetch (pid 14194, tid 14194)
  01-20 17:19:50.772: W/System.err(14194): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONArray
  01-20 17:19:50.772: W/System.err(14194):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:19:50.772: W/System.err(14194):    at org.json.JSONArray.&lt;init&gt;(JSONArray.java:91)
  01-20 17:19:50.772: W/System.err(14194):    at org.json.JSONArray.&lt;init&gt;(JSONArray.java:103)
  01-20 17:19:50.772: W/System.err(14194):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:19:50.772: W/System.err(14194):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:19:50.772: W/System.err(14194):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:19:50.772: W/System.err(14194):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:19:50.772: W/System.err(14194):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:19:50.772: W/System.err(14194):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:19:50.772: W/System.err(14194):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:19:50.772: W/System.err(14194):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:19:50.772: W/System.err(14194):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:19:50.772: W/System.err(14194):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:19:50.772: W/System.err(14194):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:19:50.772: W/System.err(14194):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:19:50.772: W/System.err(14194):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:19:50.772: W/System.err(14194):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:22:24.402: W/System.err(14194): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONArray
  01-20 17:22:24.402: W/System.err(14194):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:22:24.402: W/System.err(14194):    at org.json.JSONArray.&lt;init&gt;(JSONArray.java:91)
  01-20 17:22:24.402: W/System.err(14194):    at org.json.JSONArray.&lt;init&gt;(JSONArray.java:103)
  01-20 17:22:24.402: W/System.err(14194):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:22:24.402: W/System.err(14194):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:22:24.402: W/System.err(14194):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:22:24.402: W/System.err(14194):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:22:24.402: W/System.err(14194):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:22:24.402: W/System.err(14194):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:22:24.402: W/System.err(14194):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:22:24.402: W/System.err(14194):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:22:24.402: W/System.err(14194):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:22:24.402: W/System.err(14194):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:22:24.402: W/System.err(14194):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:22:24.402: W/System.err(14194):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:22:24.402: W/System.err(14194):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:22:24.402: W/System.err(14194):    at dalvik.system.NativeStart.main(Native Method)
  01-20 17:32:17.792: W/System.err(14194): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONArray
  01-20 17:32:17.792: W/System.err(14194):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:32:17.792: W/System.err(14194):    at org.json.JSONArray.&lt;init&gt;(JSONArray.java:91)
  01-20 17:32:17.792: W/System.err(14194):    at org.json.JSONArray.&lt;init&gt;(JSONArray.java:103)
  01-20 17:32:17.792: W/System.err(14194):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:32:17.792: W/System.err(14194):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:32:17.792: W/System.err(14194):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:32:17.792: W/System.err(14194):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:32:17.792: W/System.err(14194):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:32:17.802: W/System.err(14194):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:32:17.802: W/System.err(14194):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:32:17.802: W/System.err(14194):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:32:17.802: W/System.err(14194):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:32:17.802: W/System.err(14194):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:32:17.802: W/System.err(14194):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:32:17.802: W/System.err(14194):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:32:17.802: W/System.err(14194):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:32:17.802: W/System.err(14194):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>My PHP Page</p>
  
  <pre><code>&lt;?php
  include("config.php");
  $user=$_REQUEST['user'];
  $sql1=mysql_query("select * from reg_table where user='$user'")or die (mysql_error());
  $c = mysql_num_rows($sql1);
  while($sql2 = mysql_fetch_array($sql1))
  {
  $arrDet['Event']['Details'][]=$sql2;
  }
  if($c&gt;0)
  {
  $arrDet['Details']['status']="success";
  }
  else
  {
  $arrDet['Details']['status']="Nodata";
  }
  echo json_encode($arrDet);
  ?&gt;
  </code></pre>
  
  <p>Main Logcat Error</p>
  
  <pre><code>01-20 17:47:26.442: W/System.err(14954): org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject
  01-20 17:47:26.442: W/System.err(14954):    at org.json.JSON.typeMismatch(JSON.java:111)
  01-20 17:47:26.442: W/System.err(14954):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
  01-20 17:47:26.442: W/System.err(14954):    at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
  01-20 17:47:26.442: W/System.err(14954):    at com.example.fetch.Disp.parsingmethod(Disp.java:86)
  01-20 17:47:26.442: W/System.err(14954):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:76)
  01-20 17:47:26.442: W/System.err(14954):    at com.example.fetch.Disp$aji.onPostExecute(Disp.java:1)
  01-20 17:47:26.442: W/System.err(14954):    at android.os.AsyncTask.finish(AsyncTask.java:602)
  01-20 17:47:26.442: W/System.err(14954):    at android.os.AsyncTask.access$600(AsyncTask.java:156)
  01-20 17:47:26.442: W/System.err(14954):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
  01-20 17:47:26.442: W/System.err(14954):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-20 17:47:26.442: W/System.err(14954):    at android.os.Looper.loop(Looper.java:137)
  01-20 17:47:26.442: W/System.err(14954):    at android.app.ActivityThread.main(ActivityThread.java:4424)
  01-20 17:47:26.442: W/System.err(14954):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-20 17:47:26.442: W/System.err(14954):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-20 17:47:26.442: W/System.err(14954):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
  01-20 17:47:26.442: W/System.err(14954):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
  01-20 17:47:26.442: W/System.err(14954):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>