У меня есть такой JSON ответ
{"error":false,"country":"United Kingdom","country_id":"903",
"currency":"GBP","product_list":["5","10","15","20","25","30","40","50"]}
И я могу без проблем проанализировать страну, country_id и валюту, проблема начинается со списка продуктов, когда я пытаюсь его проанализировать ! ниже кода
try {
boolean error = response.getBoolean("error");
if (!error){
String country = response.getString("country");
int country_id = response.getInt("country_id");
String currency = response.getString("currency");
List<Tarif> tarifs = new
Gson().fromJson(response.getJSONArray("product_list").toString(), new
TypeToken<List<Tarif>>(){}.getType());
new DtoneTarifs(country, country_id, currency, tarifs);
}
}
А вот мой класс Tarif и Other
public class Tarifs {
public String country;
public int country_id;
public String currency;
public List<Tarif> tarifList;
public Tarifs (String country, int country_id, String currency, List<Tarif> tarif){
this.country = country;
this.country_id = country_id;
this.currency = currency;
this.tarifList = tarif;
}
}
Я хочу заполнить список product_list в классе Tarif, где только один параметр принимает и отображать их в recycler_view