I am new to GSON. I need to convert the following JSON response into a List.
JSON response:
{
"data": [{
"data": {
"ac_id": "000",
"user_id": "000",
"title": "AAA"
}
}, {
"data": {
"ac_id": "000",
"user_id": "000",
"title": "AAA"
}
}]
}
I have a class to cast data
Account. java
public class Account {
public int ac_id;
public int user_id;
public String title;
@Override
public String toString(){
return "Account{"+
"ac_id="+ac_id+
", user_id="+user_id+
", title="+title+'}';
}
}
When I cast the response with my class I get:
[Account{ac_id="000", user_id="000", title="AAA"}, Account{ac_id="000", user_id="000", title="AAA"}]
Now I need to put these two values into a List<Account>
.
What do you suggest?