how can I parse JSON array that contains JSON objects without names and each object have his own attributes in Android with Retrofit2. Json is something like this:
[
{
"username":"alexruskovski",
"age":27,
"active":true
},
{
"languages":"Java",
"occupation":"Programming",
"phone_num":"123456789",
"email":"asdf@qwe.com"
}
]
And I have my POJO's like this:
user:
public class User{
String username;
int age;
boolean active;
}
and here is the data object:
public class Data{
String languages,
String occupation;
String phone_num;
String email;
}
and this is my main response class:
public class MainResponse{
User user;
Data data;
}
And this is how my Retrofit client getData method is
Call<List<MainResponse>> getData();