mardi 5 juillet 2016

Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $ - Retrofit

I know this question was already answered multiple times. But I still cannot figure out how to fix this in my code.

I'm using foursquare search api to get places.

This is my Retrofit interface:

public static final String API_URL ="https://api.foursquare.com/v2/";

public interface getNearPlace {

    @GET("venues/search")
    Call <List<FoursquareSearch.response.venues>> searchResults(@Query("ll") String ll,@Query("oauth_token") String oauth_token,@Query("v") String v);
}

public static getNearPlace create() {
    return new Retrofit.Builder()
            .baseUrl(API_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build()
            .create(FourSquareAPI.getNearPlace.class);
}

public class FoursquareSearch {

private response response;

public FoursquareSearch.response getResponse() {
    return response;
}

public class response {
    private List<venues> venues;
    public List<FoursquareSearch.response.venues> getVenues() {
        return venues;
    }
    public class venues {
        public String id;
        public String name;`
        public location location;
        public List<categories> categories;
        public Bitmap bitmap;

} }

I always get Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $ error. Please,help.

Aucun commentaire:

Enregistrer un commentaire