Expected Begin_array But Was Begin_object At Line 1 Column 2 Path$
I found some solutions but I really don't know how to start. 'Result': [ { 'id': 487749, 'deliveryid': 71472, 'salestransactiondetailsid
Solution 1:
You will need 2 different classes based on the response you're getting.
classCustomResponse{
privateList<Delivery> Result;
// getters and setters and constructors
}
classDelivery {
// your current default class
}
Your interface changes to
@GET("api/Ontrack/Delivery")
Call<CustomResponse> getDeliveryDetails();
The current one was not working because it expected a list of Delivery items as a response but instead got an object called result as the first item ie, your response would have looked something like this :
{
result:....
}
it expected
[.....]
Incase you do not want to create 2 classes then you'll need to modify the response such that it send back only the list without the Result:
.
Post a Comment for "Expected Begin_array But Was Begin_object At Line 1 Column 2 Path$"