title: String cannot be converted to JSON Object
body: <p>When I am fetching data from local database, I am getting value in a Json object and its converting it into String and the result can be seen in local server.</p>
  
  <p>But..when i am executing the same code on the live database, the data cannot be converted to Json object.</p>
  
  <p>This is my code - </p>
  
  <pre><code>    class Createoffer extends AsyncTask&lt;String, String, String&gt; {
  
              @Override
              protected void onPreExecute() {
                  // TODO Auto-generated method stub
                  super.onPreExecute();
              }
  
              @Override
              protected String doInBackground(String... params) {
                  // TODO Auto-generated method stub
                  HttpClient httpclient = new DefaultHttpClient();
                  HttpPost httppost = new HttpPost(
                          "http://10.0.2.2/Upshot_Loyalty_Program/android_api_retailer/create_offer.php");
                  try {
                      session = new SessionManager(getApplicationContext());
                      HashMap&lt;String, String&gt; user = session.getUserDetails();
                      bus_id = user.get(SessionManager.KEY_B_ID);
                      emp_id = user.get(SessionManager.KEY_E_ID);
                      List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(
                              2);
                      nameValuePairs.add(new BasicNameValuePair("bus_id", bus_id));
                      nameValuePairs.add(new BasicNameValuePair("offer_name",
                              offer_name_final));
                      nameValuePairs.add(new BasicNameValuePair("offer_discount",
                              offer_discount));
                      nameValuePairs.add(new BasicNameValuePair("date",
                              offer_valid_till));
                      nameValuePairs.add(new BasicNameValuePair("start_time",
                              offer_starting_time));
                      nameValuePairs.add(new BasicNameValuePair("end_time",
                              offer_ending_time));
                      nameValuePairs.add(new BasicNameValuePair("redeem_times",
                              offer_times_redeem));
                      nameValuePairs
                              .add(new BasicNameValuePair("created_by", emp_id));
                      nameValuePairs.add(new BasicNameValuePair("offer_created_for",
                              offer_created_for1));
                      httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                      HttpResponse response = httpclient.execute(httppost);
                      response.getStatusLine().getStatusCode();
                      HttpEntity getResponseEntity = response.getEntity();
                      responseString = EntityUtils.toString(getResponseEntity);
                  } catch (ClientProtocolException e) {
                      // TODO Auto-generated catch block
                  } catch (IOException e) {
                      // TODO Auto-generated catch block
                  }
                  return responseString;
              }
  
              @Override
              protected void onPostExecute(String result) {
                  // TODO Auto-generated method stub
                  try {
                      JSONObject json = new JSONObject(responseString);
                      JSONArray jArray = json.getJSONArray("customer");
                      for (int i = 0; i &lt; jArray.length(); i++) {
                          jsonobj = jArray.getJSONObject(i);
                          success = jsonobj.getString("success");
                          System.out.println(success);
                      }
                      if (success.equals("1")) {
                          Intent innv = new Intent(getApplicationContext(),
                                  Offers.class);
                          Editor editor = sharedpreferences.edit();
                          editor.clear();
                          editor.commit();
                          startActivity(innv);
                          Toast toast = Toast.makeText(getApplicationContext(),
                                  "Offer sent successful to " + total_eli_cus
                                          + " customers ", Toast.LENGTH_SHORT);
                          toast.setGravity(Gravity.CENTER, 0, 0);
                          toast.show();
                      } else {
                          Toast toast = Toast.makeText(getApplicationContext(),
                                  "Offer Not Created", Toast.LENGTH_SHORT);
                          toast.setGravity(Gravity.CENTER, 0, 0);
                          toast.show();
                      }
                  } catch (JSONException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
              }
          }
  </code></pre>
  
  <p>This is the error which i am getting in the logcat - </p>
  
  <pre><code>        08-04 17:34:59.724: W/System.err(2649): org.json.JSONException: Value You of type java.lang.String cannot be converted to JSONObject
          08-04 17:34:59.724: W/System.err(2649):  at org.json.JSON.typeMismatch(JSON.java:111)
          08-04 17:34:59.729: W/System.err(2649):  at org.json.JSONObject.&lt;init&gt;(JSONObject.java:158)
          08-04 17:34:59.729: W/System.err(2649):  at org.json.JSONObject.&lt;init&gt;(JSONObject.java:171)
          08-04 17:34:59.739: W/System.err(2649):  at com.pack.upshot.Offer_success$Createoffer.onPostExecute(Offer_success.java:152)
          08-04 17:34:59.739: W/System.err(2649):  at com.pack.upshot.Offer_success$Createoffer.onPostExecute(Offer_success.java:1)
          08-04 17:34:59.739: W/System.err(2649):  at android.os.AsyncTask.finish(AsyncTask.java:602)
          08-04 17:34:59.750: W/System.err(2649):  at android.os.AsyncTask.access$600(AsyncTask.java:156)
          08-04 17:34:59.750: W/System.err(2649):  at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
          08-04 17:34:59.760: W/System.err(2649):  at android.os.Handler.dispatchMessage(Handler.java:99)
          08-04 17:34:59.760: W/System.err(2649):  at android.os.Looper.loop(Looper.java:137)
          08-04 17:34:59.769: W/System.err(2649):  at android.app.ActivityThread.main(ActivityThread.java:4340)
          08-04 17:34:59.769: W/System.err(2649):  at java.lang.reflect.Method.invokeNative(Native Method)
          08-04 17:34:59.789: W/System.err(2649):  at java.lang.reflect.Method.invoke(Method.java:511)
          08-04 17:34:59.789: W/System.err(2649):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
          08-04 17:34:59.789: W/System.err(2649):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
          08-04 17:34:59.789: W/System.err(2649):  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>This is my result in JSON - </p>
  
  <pre><code>{
      "customer": [
          {
              "success": "1"
          }
      ]
  }
  </code></pre>