I use Retro Fit to connect to the API online. But I get this error when trying to parse the returned data.
retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
The returned data is in This format and model for the data is also given below:
iGPlaceApi.getStreams(ITEMS_PER_PAGE, pageNumber * ITEMS_PER_PAGE, new Callback<List<mGooglePlacesApiResponse>>() { @Override public void success(List<mGooglePlacesApiResponse> mGp, Response response) { int n = mGp.size(); Object asa = mGp.toArray(); } @Override public void failure(RetrofitError retrofitError) { String error = retrofitError.toString(); } }); public class mGooglePlacesApiResponse { public String html_attributions;
Maven source share