title: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 -Retrofit
body: <p>i'm using retrofit for my project. when i try to access my webservice,in onFailure i'm getting <code>JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $</code> on LogCat.i can get response from POSTMAN</p>
  
  <p>this is postman response</p>
  
  <pre><code>{
      "status": true,
      "message": "order status updated"
  } 
  </code></pre>
  
  <p>OnCreate <strong>Update</strong>        </p>
  
  <pre><code>HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
              interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
              OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
  
          retrofit = new Retrofit.Builder()
                              .baseUrl("https://example.com/sample/")                    
                              .client(client)
      .addConverterFactory(GsonConverterFactory.create())
                              .build();
          token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9";
          id_order= 288;
          status="process";
          update();
  </code></pre>
  
  <p>Method </p>
  
  <pre><code>public void update(){
          WebserviceAPI apiService =retrofit.create(WebserviceAPI.class);
          Call&lt;UpdateOrderResponse&gt; call = apiService.updateOrder("pickorder",token,id_order,status);
          call.enqueue(new Callback&lt;UpdateOrderResponse&gt;() {
              @Override
              public void onResponse(Call&lt;UpdateOrderResponse&gt; call, Response&lt;UpdateOrderResponse&gt; response) {
  
                  UpdateOrderResponse result = response.body();
                  Log.d("orderstatus", "body: "+result);
                  returnstatus=result.isStatus();
                  msg= result.getMessage();
  
                  if(returnstatus){
                      Log.d("orderstatus","status ok");
                  }else{
                      Log.d("orderstatus","status not ok");
                  }
              }
  
              @Override
              public void onFailure(Call&lt;UpdateOrderResponse&gt; call, Throwable t) {
                  Log.d("proceedFail",""+t.getMessage());
  
              }
          });
  
      }
  </code></pre>
  
  <p>PHP service response </p>
  
  <pre><code>$response = ['status' =&gt; true,
          'message' =&gt; "order status updated",
           ];
  $this-&gt;returnJson($response);
  </code></pre>
  
  <p>UpdateOrderResponse Module class</p>
  
  <pre><code>public class UpdateOrderResponse {
      boolean status;
      String message;
  
      public boolean isStatus() {
          return status;
      }    
      public void setStatus(boolean status) {
          this.status = status;
      }    
      public String getMessage() {
          return message;
      }    
      public void setMessage(String message) {
          this.message = message;
      }
  }
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>i have added <code>gson.setLenient()</code> to retrofit.like below</p>
  
  <pre><code>Gson gson = new GsonBuilder()
                  .setLenient()
                  .create();
  retrofit = new Retrofit.Builder()
                  .baseUrl("https://example.com/sample/")
                  .client(client)
                  .addConverterFactory(GsonConverterFactory.create(gson))
                  .build();
  </code></pre>
  
  <p>then got another error on <code>onFailure</code> it is <code>Expected BEGIN_OBJECT but was STRING at line 1</code>. i have also added <code>HttpLoggingInterceptor</code> and checked my LogCat.it showing me </p>
  
  <pre><code>OkHttp: &lt;-- 200 OK https://........
  OkHttp: {"status":true,"message":"order status updated"}
  D/OkHttp: &lt;-- END HTTP (99-byte body)    
  proceedFail: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
  </code></pre>