Gson Throws Expected Begin_array But Was Begin_object Error
I am using retrofit and parse result with GSON. Don't know why but I receive this one Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path I know what this error me
Solution 1:
Change
List<DadataResponse> getDadata(@Query("query") String query);
to
DadataResponsegetDadata(@Query("query") String query);
Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path
means it's expecting an array (because you told it to) but it received an object.
It looks like you receive a single DadataResponse
and not an array of them, so you need to update your signature to match reality.
Post a Comment for "Gson Throws Expected Begin_array But Was Begin_object Error"