Search code examples
androidjsonyoutuberetrofityoutube-data-api

YouTube Data API v3 search JSON response retrofit parsing error


YouTube Data API v3 search JSON response retrofit parsing error occurred

@GET("/youtube/v3/search")
void getYouTubeVideos(@Query("key") String apiKey,
                      @Query("channelId") String channelId,
                      @Query("part") String videoPart,
                      @Query("order") String videoOrder,
                      @Query("maxResults") String maxResults,
                      Callback<ChannelListResponse> callback);

for Callback<ChannelListResponse>

I have used

`import com.google.api.services.youtube.model.ChannelListResponse`

with dependency in gradle `compile 'com.google.apis:google-api-services-youtube:v3-rev162-1.21.0'`

but in failure method it returns error retrofit.RetrofitError: invalid value for field

plz guide me for better Thanks In advance


Solution

  • I solved it by creating custom pojo class relevant to desired data because com.google.api.services.youtube.model.ChannelListResponse is not having any @Expose annotation nor @SerializedName() that's why parsing is not being successful.