title: Making news application using retrofit, D/json: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
body: <p>i'm trying to catch some data from some API and i was using Toast to make sure if there's a response or not, and i keep getting this error:- D/json: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $</p>
  <p>Thanks in advance :)</p>
  <p>Here is my Retrofit interface</p>
  <pre><code>import retrofit2.Call
  import retrofit2.http.GET
  
  interface CallableInterface {
  
      @GET(&quot;/api/v1/dev_tracker?page=1&amp;source=reddit&quot;)
      fun getNews(): Call&lt;News&gt;
  }
  </code></pre>
  <p>And News Class that i've called in the interface</p>
  <pre><code>
  import com.google.gson.annotations.SerializedName
  import java.nio.file.Files.size
  
  class News {
  
      val dev_posts: Array&lt;Article&gt; = arrayOf(Article())
  
  
  
  }
  
  class Article {
  
      var content: String = &quot;&quot;
  
      var language: String = &quot;&quot;
  
      var title: String = &quot;&quot;
  
  }
  </code></pre>
  <p>and here is my activity</p>
  <pre><code>fun loadNews() {
          val progress: ProgressBar = findViewById(R.id.pb)
          val retrofit = Retrofit
              .Builder()
              .baseUrl(&quot;https://newworldfans.com&quot;)
              .addConverterFactory(GsonConverterFactory.create())
              .build()
  
          val callable = retrofit.create(CallableInterface::class.java)
          val getNews = callable.getNews()
          getNews.enqueue(object : Callback&lt;News&gt; {
              override fun onResponse(call: Call&lt;News&gt;, response: Response&lt;News&gt;) {
                  progress.visibility = View.GONE
                  val news: News? = response.body()
                  Toast.makeText(this@DrawerActivity,
                     &quot;${news?.dev_posts?.get(0)?.content} &quot;, Toast.LENGTH_SHORT).show();
                  Log.d(&quot;jsoon&quot;, &quot;Success&quot;  )
              }
  
              override fun onFailure(call: Call&lt;News&gt;, t: Throwable) {
                  progress.visibility = View.GONE
                  Toast.makeText(this@DrawerActivity, &quot;Failed&quot;, Toast.LENGTH_SHORT).show();
                  Log.d(&quot;json&quot;, &quot;${t.localizedMessage} &quot;)
              }
          })
  </code></pre>