I am trying to parse JSON code like this below :
[
{
"id": 1,
"name": "Кафе 1",
"tracks": [
I think problem is here
{
"id": 10,
"name": "track 2.mp3",
"url": "track 2.mp3",
...
This is my ApiInterface.java
@GET(".../playlists")
Call<FDYPlaylists> getPlaylists(@HeaderMap Map<String, String> headers);
ApiUtils.java
public static final String BASE_URL = "url";
public static APIService getAPIService() {
return RetrofitClient.getClient(BASE_URL).create(APIService.class);
}
You can find below my RetrofitClient.java
private static Retrofit retrofit = null;
public static Retrofit getClient(String baseUrl) {
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
And the call is like below :
Map<String, String> map = new HashMap<>();
map.put("Content-Type", "application/json");
map.put("Authorization", "Bearer " + token);
mAPIService.getPlaylists(map).enqueue(new Callback<FDYPlaylists>() {
.....
This is the error I am getting:
Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2