How can I solve this error :Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

Your json return as JSON object. But you are trying to convert into Json array

 Call<List<Loginresponse>> - you try to convert result as JSON Array (list) 

Solution

Get the raw json result & convert the pojo using http://www.jsonschema2pojo.org/ and try again


You are trying to store json object in list that's why you are getting error . check your JSON response start with { curly bracket it means it is object not an array . array start with [ square bracket .

@PUT("/user/profile/{userId}")
fun updateProfile(@Header("Authorization") token: String?, @Path("userId") userID: String, @Part file: MultipartBody.Part): Call<List<Loginresponse>>

replace Call<List<Loginresponse>> with Call<Loginresponse> all over where you using updateProfile method