title: JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $ Error
body: <p>I'm trying to create forget password script for my app .When i run my apk and try to rest my password i got error which says Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $ Error, Everything is working fine in my apk i can login and logout or register but when i reset password i got JsonReader.setLenient(true) error. My apk json is working and it's correct. Please Help me. I'm Sharing my code.</p>
  
  <pre><code>{
     "operation":"resPassReq",
     "user":{
         "email":"name@example.com"
  
     }
  }
  </code></pre>
  
  <p>and if the request is sucess the response would be similar to,</p>
  
  <pre><code>{
    "result": "success",
    "message": "Check your mail for reset password code."
  }
  </code></pre>
  
  <p>For finishing password reset process the request would be similar to,</p>
  
  <pre><code>{
     "operation":"resPass",
     "user":{
         "email":"name@example.com",
         "code":"bcfqa3",
         "password":"rjamalw"
  
     }
  }
  </code></pre>
  
  <p>and if the request is success the response would be similar to,</p>
  
  <pre><code>{
    "result": "success",
    "message": "Password Changed Successfully"
  }
  </code></pre>
  
  <p>ResetPasswordFragment.java</p>
  
  <pre><code>import retrofit2.Call;
  import retrofit2.Callback;
  import retrofit2.Retrofit;
  import retrofit2.converter.gson.GsonConverterFactory;
  
  public class ResetPasswordFragment extends Fragment implements View.OnClickListener{
  
      private AppCompatButton btn_reset;
      private EditText et_email,et_code,et_password;
      private TextView tv_timer;
      private ProgressBar progress;
      private boolean isResetInitiated = false;
      private String email;
      private CountDownTimer countDownTimer;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.fragment_password_reset,container,false);
          initViews(view);
          return view;
      }
  
      private void initViews(View view){
  
          btn_reset = (AppCompatButton)view.findViewById(R.id.btn_reset);
          tv_timer = (TextView)view.findViewById(R.id.timer);
          et_code = (EditText)view.findViewById(R.id.et_code);
          et_email = (EditText)view.findViewById(R.id.et_email);
          et_password = (EditText)view.findViewById(R.id.et_password);
          et_password.setVisibility(View.GONE);
          et_code.setVisibility(View.GONE);
          tv_timer.setVisibility(View.GONE);
          btn_reset.setOnClickListener(this);
          progress = (ProgressBar)view.findViewById(R.id.progress);
  
  
      }
  
      @Override
      public void onClick(View v) {
          switch (v.getId()){
  
              case R.id.btn_reset:
  
                  if(!isResetInitiated) {
  
  
                      email = et_email.getText().toString();
                      if (!email.isEmpty()) {
                          progress.setVisibility(View.VISIBLE);
                          initiateResetPasswordProcess(email);
                      } else {
  
                          Snackbar.make(getView(), "Fields are empty !", Snackbar.LENGTH_LONG).show();
                      }
                  } else {
  
                      String code = et_code.getText().toString();
                      String password = et_password.getText().toString();
  
                      if(!code.isEmpty() &amp;&amp; !password.isEmpty()){
  
                          finishResetPasswordProcess(email,code,password);
                      } else {
  
                          Snackbar.make(getView(), "Fields are empty !", Snackbar.LENGTH_LONG).show();
                      }
  
                  }
  
                  break;
          }
      }
  
      private void initiateResetPasswordProcess(String email){
  
          Retrofit retrofit = new Retrofit.Builder()
                  .baseUrl(Constants.BASE_URL)
                  .addConverterFactory(GsonConverterFactory.create())
                  .build();
  
          RequestInterface requestInterface = retrofit.create(RequestInterface.class);
  
          User user = new User();
          user.setEmail(email);
          ServerRequest request = new ServerRequest();
          request.setOperation(Constants.RESET_PASSWORD_INITIATE);
          request.setUser(user);
          Call&lt;ServerResponse&gt; response = requestInterface.operation(request);
  
          response.enqueue(new Callback&lt;ServerResponse&gt;() {
              @Override
              public void onResponse(Call&lt;ServerResponse&gt; call, retrofit2.Response&lt;ServerResponse&gt; response) {
  
                  ServerResponse resp = response.body();
                  Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
  
                  if(resp.getResult().equals(Constants.SUCCESS)){
  
                      Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
                      et_email.setVisibility(View.GONE);
                      et_code.setVisibility(View.VISIBLE);
                      et_password.setVisibility(View.VISIBLE);
                      tv_timer.setVisibility(View.VISIBLE);
                      btn_reset.setText("Change Password");
                      isResetInitiated = true;
                      startCountdownTimer();
  
                  } else {
  
                      Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
  
                  }
                  progress.setVisibility(View.INVISIBLE);
              }
  
              @Override
              public void onFailure(Call&lt;ServerResponse&gt; call, Throwable t) {
  
                  progress.setVisibility(View.INVISIBLE);
                  Log.d(Constants.TAG,"failed");
                  Snackbar.make(getView(), t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
                  Log.d(Constants.TAG, t.getLocalizedMessage());
              }
          });
      }
  
      private void finishResetPasswordProcess(String email,String code, String password){
  
          Retrofit retrofit = new Retrofit.Builder()
                  .baseUrl(Constants.BASE_URL)
                  .addConverterFactory(GsonConverterFactory.create())
                  .build();
  
          RequestInterface requestInterface = retrofit.create(RequestInterface.class);
  
          User user = new User();
          user.setEmail(email);
          user.setCode(code);
          user.setPassword(password);
          ServerRequest request = new ServerRequest();
          request.setOperation(Constants.RESET_PASSWORD_FINISH);
          request.setUser(user);
          Call&lt;ServerResponse&gt; response = requestInterface.operation(request);
  
          response.enqueue(new Callback&lt;ServerResponse&gt;() {
              @Override
              public void onResponse(Call&lt;ServerResponse&gt; call, retrofit2.Response&lt;ServerResponse&gt; response) {
  
                  ServerResponse resp = response.body();
                  Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
  
                  if(resp.getResult().equals(Constants.SUCCESS)){
  
                      Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
                      countDownTimer.cancel();
                      isResetInitiated = false;
                      goToLogin();
  
                  } else {
  
                      Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
  
                  }
                  progress.setVisibility(View.INVISIBLE);
              }
  
              @Override
              public void onFailure(Call&lt;ServerResponse&gt; call, Throwable t) {
  
                  progress.setVisibility(View.INVISIBLE);
                  Log.d(Constants.TAG,"failed");
                  Snackbar.make(getView(), t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
  
              }
          });
      }
  
      private void startCountdownTimer(){
          countDownTimer = new CountDownTimer(120000, 1000) {
  
              public void onTick(long millisUntilFinished) {
                  tv_timer.setText("Time remaining : " + millisUntilFinished / 1000);
              }
  
              public void onFinish() {
                  Snackbar.make(getView(), "Time Out ! Request again to reset password.", Snackbar.LENGTH_LONG).show();
                  goToLogin();
              }
          }.start();
      }
  
      private void goToLogin(){
  
          Fragment login = new LoginFragment();
          FragmentTransaction ft = getFragmentManager().beginTransaction();
          ft.replace(R.id.fragment_frame,login);
          ft.commit();
      }
  }
  </code></pre>
  
  <p>RequestInterface.java</p>
  
  <pre><code>public interface RequestInterface {
  
      @POST("req/")
      Call&lt;ServerResponse&gt; operation(@Body ServerRequest request);
  
  }
  </code></pre>
  
  <p>But When i change my code like below, Everything is working fine, but problem is that got response onFailure</p>
  
  <pre><code>private void initiateResetPasswordProcess(String email){
          HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
          interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
          OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
          Retrofit retrofit = new Retrofit.Builder()
                  .baseUrl(Constants.BASE_URL)
                  .client(client)
                  .addConverterFactory(GsonConverterFactory.create())
                  .build();
  
          RequestInterface requestInterface = retrofit.create(RequestInterface.class);
  
          User user = new User();
          user.setEmail(email);
          ServerRequest request = new ServerRequest();
          request.setOperation(Constants.RESET_PASSWORD_INITIATE);
          request.setUser(user);
          Call&lt;ServerResponse&gt; response = requestInterface.operation(request);
  
          response.enqueue(new Callback&lt;ServerResponse&gt;() {
              @Override
              public void onResponse(Call&lt;ServerResponse&gt; call, retrofit2.Response&lt;ServerResponse&gt; response) {
  
                  ServerResponse resp = response.body();
                  Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
  
                  if(resp.getResult().equals(Constants.SUCCESS)){
  
                      Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
                      et_email.setVisibility(View.GONE);
                      et_code.setVisibility(View.VISIBLE);
                      et_password.setVisibility(View.VISIBLE);
                      tv_timer.setVisibility(View.VISIBLE);
                      btn_reset.setText("Change Password");
                      isResetInitiated = true;
                      startCountdownTimer();
  
                  } else {
  
                      Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
  
                  }
                  progress.setVisibility(View.INVISIBLE);
              }
  
              @Override
              public void onFailure(Call&lt;ServerResponse&gt; call, Throwable t) {
  
                  progress.setVisibility(View.INVISIBLE);
                  Log.d(Constants.TAG,"failed");
                 // Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
                  et_email.setVisibility(View.GONE);
                  et_code.setVisibility(View.VISIBLE);
                  et_password.setVisibility(View.VISIBLE);
                  tv_timer.setVisibility(View.VISIBLE);
                  btn_reset.setText("Change Password");
                  isResetInitiated = true;
                  startCountdownTimer();
                 // Snackbar.make(getView(), t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
  
  
              }
          });
      }
  
      private void finishResetPasswordProcess(String email,String code, String password){
          HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
          interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
          OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
  
          Retrofit retrofit = new Retrofit.Builder()
                  .baseUrl(Constants.BASE_URL)
                  .client(client)
                  .addConverterFactory(GsonConverterFactory.create())
                  .build();
  
          RequestInterface requestInterface = retrofit.create(RequestInterface.class);
  
          User user = new User();
          user.setEmail(email);
          user.setCode(code);
          user.setPassword(password);
          ServerRequest request = new ServerRequest();
          request.setOperation(Constants.RESET_PASSWORD_FINISH);
          request.setUser(user);
          Call&lt;ServerResponse&gt; response = requestInterface.operation(request);
  
          response.enqueue(new Callback&lt;ServerResponse&gt;() {
              @Override
              public void onResponse(Call&lt;ServerResponse&gt; call, retrofit2.Response&lt;ServerResponse&gt; response) {
  
                  ServerResponse resp = response.body();
                  Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
  
                  if(resp.getResult().equals(Constants.SUCCESS)){
  
                      Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
                      countDownTimer.cancel();
                      isResetInitiated = false;
                      goToLogin();
  
                  } else {
  
                      Snackbar.make(getView(), resp.getMessage(), Snackbar.LENGTH_LONG).show();
  
                  }
                  progress.setVisibility(View.INVISIBLE);
              }
  
              @Override
              public void onFailure(Call&lt;ServerResponse&gt; call, Throwable t) {
  
                  progress.setVisibility(View.INVISIBLE);
                  Log.d(Constants.TAG,"failed");
                 // Snackbar.make(getView(), t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
                  countDownTimer.cancel();
                  isResetInitiated = false;
                  goToLogin();
  
              }
          });
      }
  </code></pre>
  
  <p>ServerResponse.java</p>
  
  <pre><code>public class ServerResponse {
  
      private String result;
      private String message;
      private User user;
  
      public String getResult() {
          return result;
      }
  
      public String getMessage() {
          return message;
      }
  
      public User getUser() {
          return user;
      }
  }
  </code></pre>
  
  <p>ServerRequest.java</p>
  
  <pre><code>public class ServerRequest {
  
      private String operation;
      private User user;
  
      public void setOperation(String operation) {
          this.operation = operation;
      }
  
      public void setUser(User user) {
          this.user = user;
      }
  }
  </code></pre>