title: Error: Value Fatal of type java.lang.String cannot be converted to JSONObject
body: <p>In Android, I want to implement a login system and I'm having an error in converting a <code>String</code> into a <code>JsonObject</code>. This is my Activity:</p>
  
  <pre><code>public class Login extends Activity implements OnClickListener {    
      private EditText user, pass;
      private Button mSubmit;
  
      private ProgressDialog pDialog;
      static {
          StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
  
          StrictMode.setThreadPolicy(policy);
      }
      JSONParser jsonParser = new JSONParser();
  
      private static final String LOGIN_URL = "http://sorifgroupcom.ipage.com/Android/login.php";
  
      private static final String TAG_SUCCESS = "success";
      private static final String TAG_MESSAGE = "message";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {        
          super.onCreate(savedInstanceState);
          setContentView(R.layout.login);
  
          user = (EditText) findViewById(R.id.emailLogin);
          pass = (EditText) findViewById(R.id.MPLogin);
  
          mSubmit = (Button) findViewById(R.id.BtnLogin);
  
          mSubmit.setOnClickListener(this);        
      }
  
      @Override
      public void onClick(View v) {    
          switch (v.getId()) {
          case R.id.BtnLogin:
              new AttemptLogin().execute();
              break;
  
  
          default:
              break;
          }
      }
  
      class AttemptLogin extends AsyncTask&lt;String, String, String&gt; {
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          pDialog = new ProgressDialog(Login.this);
          pDialog.setMessage("Attempting login...");
          pDialog.setIndeterminate(false);
          pDialog.setCancelable(true);
          pDialog.show();
      }
  
      @Override
      protected String doInBackground(String... args) {
          // TODO Auto-generated method stub
          // Check for success tag
          int success;
          String username = user.getText().toString();
          String password = pass.getText().toString();
          try {
              // Building Parameters
              List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
              params.add(new BasicNameValuePair("email", username));
              params.add(new BasicNameValuePair("motdepasse", password));
  
              Log.d("request!", "starting");
              // getting product details by making HTTP request
              Log.i("tesssssssssssssssssssst", "test");
              JSONObject json = jsonParser.makeHttpRequest(LOGIN_URL, "POST",
                      params);
  
              // check your log for json response
              Log.d("Login attempt", json.toString());
  
              // json success tag
              success = json.getInt(TAG_SUCCESS);
              if (success == 1) {
                  Log.d("Login Successful!", json.toString());
                  // save user data
                  SharedPreferences sp = PreferenceManager
                          .getDefaultSharedPreferences(Login.this);
                  Editor edit = sp.edit();
                  edit.putString("email", username);
                  edit.commit();
                  finish();
                  return json.getString(TAG_MESSAGE);
              } else {
                  Log.d("Login Failure!", json.getString(TAG_MESSAGE));
                  return json.getString(TAG_MESSAGE);
              }
          } catch (JSONException e) {
              e.printStackTrace();
          }
          Log.i("tesssssssssssssssssssst", "test");
          return null;
  
      }
  
      protected void onPostExecute(String file_url) {
          pDialog.cancel();
          if (file_url != null) {
              Toast.makeText(Login.this, "", Toast.LENGTH_LONG).show();
          }
  
      }
  
  }
  </code></pre>
  
  <p>And the LogCat prints the following errors when I put values into <code>TextEdit</code>: </p>
  
  <pre><code>E/JSON Parser(619): Error parsing data org.json.JSONException: 
      Value Fatal of type java.lang.String cannot be converted to JSONObject
  E/AndroidRuntime(619): FATAL EXCEPTION: AsyncTask #1
  E/AndroidRuntime(619): java.lang.RuntimeException: An error occured 
      while executing   doInBackground()
  
  E/AndroidRuntime(619):  at android.os.AsyncTask$3.done(AsyncTask.java:299)
  E/AndroidRuntime(619):  at   java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
  E/AndroidRuntime(619):  at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
  E/AndroidRuntime(619):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
  E/AndroidRuntime(619):  at java.util.concurrent.FutureTask.run(FutureTask.java:137)
  E/AndroidRuntime(619):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
  E/AndroidRuntime(619):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
  E/AndroidRuntime(619):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
  E/AndroidRuntime(619):  at java.lang.Thread.run(Thread.java:856)
  E/AndroidRuntime(619): Caused by: java.lang.NullPointerException
  E/AndroidRuntime(619):  at  org.Soufiane.voyagesociale.Login$AttemptLogin.doInBackground(Login.java:110)
  E/AndroidRuntime(619):  at org.Soufiane.voyagesociale.Login$AttemptLogin.doInBackground(Login.java:1)
  E/AndroidRuntime(619):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
  E/AndroidRuntime(619):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
  E/AndroidRuntime(619):  ... 5 more
  E/InputDispatcher(163): channel '41868f48  org.Soufiane.voyagesociale/org.Soufiane.voyagesociale.Login (server)' ~ Channel is unrecoverably broken and will be  disposed!
  E/InputDispatcher(163): Received spurious receive callback for unknown input channel.    fd=193, events=0x9
  E/BufferQueue(35): [] drainQueueLocked: BufferQueue has been abandoned!
  </code></pre>
  
  <p>What does this error mean? And how can I fix this?</p>