title: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ when using Retrofit2 which returns onFailure
body: <p>I'm getting this error ** Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $**</p>
  <p>gradles below which I used for retrofit</p>
  <pre><code>
   implementation 'com.squareup.retrofit2:retrofit:2.6.0'
      implementation 'com.google.code.gson:gson:2.8.6'
      implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
      implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'
  
  </code></pre>
  <p>Retrofit class</p>
  <pre><code>class RetrofitClient private constructor() {
      val myApi: Api
  
      companion object {
          @get:Synchronized
          var instance: RetrofitClient? = null
              get() {
                  if (field == null) {
                      field = RetrofitClient()
                  }
                  return field
              }
              private set
      }
  
      init {
  
          val gson = GsonBuilder()
                  .setLenient()
                  .create()
          val interceptor = HttpLoggingInterceptor()
          interceptor.level = HttpLoggingInterceptor.Level.BODY
          val client : OkHttpClient = OkHttpClient.Builder().addInterceptor(interceptor).build()
  
          val retrofit: Retrofit = Retrofit.Builder().baseUrl(&quot;http://ctyf.co.in/api/&quot;)
                  .client(client)
              .addConverterFactory(GsonConverterFactory.create(gson))
              .build()
          myApi = retrofit.create(Api::class.java)
  
      }
  }
  </code></pre>
  <p>Api interface</p>
  <pre><code>public interface Api {
  
      @Headers(&quot;Content-Type: application/json&quot;)
      @GET(&quot;companyvehiclelatestinfo?token=F934A0C439/&quot;)
  
      fun getLatLngs(): Call&lt;ResponseLoc?&gt;?
  }
  </code></pre>
  <p>data class</p>
  <pre><code>data class ResponseLoc(
      val Vehicle: List&lt;Vehicle&gt;
  )
  </code></pre>
  <p>data model</p>
  <pre><code>data class Vehicle(
      val Angle: String,
      val Date: String,
      val Ignition: String,
      val Imei: String,
      val Lat: String,
      val Location: String,
      val Long: String,
      val Speed: String,
      val Tempr: String,
      val VehicleNo: String
  )
  </code></pre>
  <p>finally calling here</p>
  <pre><code>private fun getLatLngs() {
  
          val call: Call&lt;ResponseLoc?&gt;? = RetrofitClient.instance!!.myApi.getLatLngs()
          call!!.enqueue(object : Callback&lt;ResponseLoc?&gt; {
  
                override fun onResponse(call: Call&lt;ResponseLoc?&gt;, response: Response&lt;ResponseLoc?&gt;) {
                  val responseLoc: List&lt;ResponseLoc&gt; = response.body() as List&lt;ResponseLoc&gt;
  
                  //Creating an String array for the ListView
                  val data = arrayOfNulls&lt;String&gt;(responseLoc.size)
  
                  for (i in responseLoc.indices) {
                      data[i] = responseLoc[i].Vehicle.toString()
                      Log.d(&quot;apiii&quot;,  data[i].toString())
                  }
  
              }
  
              override fun onFailure(call: Call&lt;ResponseLoc?&gt;, t: Throwable) {
  
                  Log.d(&quot;apii&quot;,  t.message.toString())
              }
  
          })
      }
  </code></pre>
  <p>JSON values</p>
  <pre><code>{&quot;Vehicle&quot;:[{&quot;VehicleNo&quot;:&quot;Test&quot;,&quot;Imei&quot;:&quot;354019&quot;,&quot;Location&quot;:&quot;Tamil Nadu-India&quot;,&quot;Date&quot;:&quot;2021-03-17 19:27:12.000&quot;,&quot;Tempr&quot;:&quot;0&quot;,&quot;Ignition&quot;:&quot;&quot;,&quot;Lat&quot;:&quot;13.11&quot;,&quot;Long&quot;:&quot;80.282&quot;,&quot;Speed&quot;:&quot;0&quot;,&quot;Angle&quot;:&quot;0&quot;}]}
  </code></pre>
  <p>I have tried many stacks none of them helped</p>
  <p>Is there any other ways available except Retrofit ???</p>
  <p>anybody please help me to get the api results</p>
  <p>I have tried many stacks none of them helped</p>
  <p>Is there any other ways available except Retrofit ???</p>
  <p>anybody please help me to get the api results</p>