title: JSONException: Value of type java.lang.String cannot be converted to JSONObject
body: <p>I'm new to android, but I found an app that would go great with a web scraper that I've been working very hard on and filled a database with. This is a basic app that retrieves values from a MySQL database using a PHP script and displays them on your android device.</p>
  
  <p>Here is the PHP:</p>
  
  <pre><code>&lt;?php
  try {
      $conn = new PDO('mysql:host=localhost;dbname=beanbag', **********, *******);
      $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      $results=$conn-&gt;query('SELECT * FROM Recipes');
  
      while ($results = $row-&gt;fetch(PDO::FETCH_ASSOC)){
      $output[]=$row;
      print(json_encode($output));
      }
  
  } catch(PDOException $e) {
      echo 'ERROR: ' . $e-&gt;getMessage();
  }
  $conn = null;
  ?&gt;
  </code></pre>
  
  <p>The original code used mysql_connect but I implemented PDO instead. </p>
  
  <p>Here is the Java:</p>
  
  <pre><code>protected void onPostExecute(Void v) {
  
          // ambil data dari Json database
          try {
              JSONArray Jarray = new JSONArray(result);
              for(int i=0;i&lt;Jarray.length();i++)
              {
              JSONObject Jasonobject = null;
              //text_1 = (TextView)findViewById(R.id.txt1);
              Jasonobject = Jarray.getJSONObject(i);
  
              //get an output on the screen
              //String id = Jasonobject.getString("id");
              String name = Jasonobject.getString("Title");
              String db_detail="";
  
              if(et.getText().toString().equalsIgnoreCase(name)) {
              db_detail = Jasonobject.getString("ingredient");
              text.setText(db_detail);
              break;
              }
              //text_1.append(id+"\t\t"+name+"\t\t"+password+"\t\t"+"\n");
  
              }
              this.progressDialog.dismiss();
  
          } catch (Exception e) {
              // TODO: handle exception
              Log.e("log_tag", "Error parsing data "+e.toString());
          }
      }
  </code></pre>
  
  <p>Logcat says:</p>
  
  <blockquote>
    <p>Error parsing data org.json.JSONException: Value br of type java.lang.String cannot be converted to JSONArray</p>
  </blockquote>
  
  <p>I tried using {left brace and }right brace solution from <a href="https://stackoverflow.com/questions/18794505/get-jsonexception-value-of-type-java-lang-string-cannot-be-converted-to-jsonobj">this stackoverflow question</a>, but I don't think that's it. </p>