title: Error parsing data org.json.JSONException: End of input at character 10 of
body: <p>I am currently stuck at this error "<strong>Error parsing data org.json.JSONException: End of input at character 10 of</strong>".  I tested my PHP with Chrome's Plugin Postman and the server-side seems to be fine.  Please view code below and thank you for your help.</p>
  
  <p><strong>PHP code:</strong></p>
  
  <pre><code>public function login($alias, $password){
  $user_info = $this-&gt;getUserFromDatabase($alias, $password);
  if ($user_info != false){
  $response["success"] = "true";
  $response["user_id"] = $user_info["userID"];
  $response["userFirstName"] = $user_info["userFirstName"];
  $response["userRank"] = $user_info["userRank"];
  echo json_encode($response);
  }else{
  $response["success"] = "false";
  $response["error"] = "true";
  echo json_encode($response);
  }
  }
  
  public function getUserFromDatabase($android_alias, $android_password) {
  $db_query = mysql_query("SELECT userID, userFirstName, userRank FROM capUserTable 
  WHERE userAlias = '$android_alias' AND userPassword = '$android_password'") 
  or die(mysql_error());
  
  $query_results = mysql_fetch_assoc($db_query);
  return $query_results;
  }
  </code></pre>
  
  <p><strong>Postman results:</strong></p>
  
  <pre><code>{
  "success": "true",
  "user_id": "1",
  "userFirstName": "username",
  "userRank": "99"
  }
  </code></pre>
  
  <p><strong>JAVA code:</strong></p>
  
  <pre><code>private InputStream inputStream = null;
  private JSONObject jObject = null;
  private String json = "";
  
  public JSONparser() {
  }
  
  public JSONObject getJSONFromURL(String URL, List&lt;NameValuePair&gt; params){
  try{
  DefaultHttpClient httpClient = new DefaultHttpClient();
  HttpPost httpPost = new HttpPost(URL);
  httpPost.setEntity(new UrlEncodedFormEntity(params)); 
  HttpResponse httpResponse = httpClient.execute(httpPost);
  HttpEntity httpEntity = httpResponse.getEntity();
  inputStream = httpEntity.getContent();
  }catch(UnsupportedEncodingException e){
  e.printStackTrace();
  Log.e("UnsupportedEncodingException", "Unsupported Encoding Exception" + e.toString());
  }catch(ClientProtocolException e){
  e.printStackTrace();
  }catch(IOException e){
  e.printStackTrace();
  }catch(Exception e){
  e.printStackTrace();
  }
  
  try{
  BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "iso-8859-1"), 10);
  StringBuilder sb = new StringBuilder();
  String line = null;
  while ((line = reader.readLine()) != null){
  sb.append(line + "\n");
  }
  inputStream.close();
  json = sb.toString();
  }catch(Exception e){
  Log.e("Buffer Error", "Error converting result " + e.toString());
  }
  
  try{
  jObject = new JSONObject(json); //this is where the problem occurs
  }catch(JSONException e){
  Log.e("JSON Parser", "Error parsing data " + e.toString()); 
  }
  return jObject;
  }
  </code></pre>