Reputation: 1983
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
Upvotes: 0
Views: 1071
Reputation: 1983
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.
Upvotes: 1
Reputation: 1
I think the problem is with this line: @Query("maxResults") String,maxResults
. Check in the documentation and you will see that maxResults is not expecting a String but an unsigned integer.
Upvotes: 0