title: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $ – ArrayList
body: <p>I am getting this error when clicking the button in my project and trying to print the data as text.</p>
  <pre><code>Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
  </code></pre>
  <p>Can you help me with what I missed?</p>
  <p>MainActivity:</p>
  <pre><code>@AndroidEntryPoint
  class MainActivity : AppCompatActivity() {
      private lateinit var binding: ActivityMainBinding
      private val viewModel: PasswordGeneratorViewModel by viewModels()
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          binding = ActivityMainBinding.inflate(layoutInflater)
          setContentView(binding.root)
  
          binding.generatePassword.apply {
              setOnClickListener {
                  binding.password.text = viewModel.responsePassword.toString()
              }
          }
  
      }
  
  }
  </code></pre>
  <p>PasswordGeneratorViewModel:</p>
  <pre><code>@HiltViewModel
  class PasswordGeneratorViewModel @Inject constructor(private val repository: PasswordGeneratorRepository): ViewModel() {
  
      private val _response = MutableLiveData&lt;List&lt;PasswordModel&gt;&gt;()
      val responsePassword: LiveData&lt;List&lt;PasswordModel&gt;&gt;
          get() = _response
  
      init {
          getPassword()
      }
  
      private fun getPassword() = viewModelScope.launch {
          repository.getPasswordGenerate().let {response -&gt;
              if (response.isSuccessful){
                  _response.postValue(response.body())
              }else{
                  Log.d(&quot;tag&quot;, &quot;getPassword Error: ${response.code()}&quot;)
              }
          }
      }
  
  }
  </code></pre>
  <p>PasswordModel:</p>
  <pre><code>import com.google.gson.annotations.SerializedName
  
  data class PasswordModel(
      @SerializedName(&quot;char&quot;)
      val char: List&lt;String&gt;
  )
  </code></pre>