У меня есть этот json, который я хочу использовать, используя только модификацию, которая не очень хорошо работает
{
"point_period_data": [
[
{
"sys_point_id": "60",
"sys_point_registration": "12345678",
"sys_point_day": "21",
"sys_point_month": "12",
"sys_point_year": "18",
"sys_point_hour": "08",
"sys_point_minute": "05",
"sys_point_geo_lat": "-5.0787026",
"sys_point_geo_long": "-42.8044331",
"sys_point_status": "Falta",
"sys_point_reference_code": "dc4e6ff10a"
},
{
"sys_point_id": "61",
"sys_point_registration": "12345678",
"sys_point_day": "21",
"sys_point_month": "12",
"sys_point_year": "18",
"sys_point_hour": "17",
"sys_point_minute": "28",
"sys_point_geo_lat": "-5.0787569",
"sys_point_geo_long": "-42.804378",
"sys_point_status": "Falta",
"sys_point_reference_code": "b11a829fda"
},
{
"sys_point_id": "62",
"sys_point_registration": "12345678",
"sys_point_day": "21",
"sys_point_month": "12",
"sys_point_year": "18",
"sys_point_hour": "17",
"sys_point_minute": "28",
"sys_point_geo_lat": "-5.0787571",
"sys_point_geo_long": "-42.8043877",
"sys_point_status": "Falta",
"sys_point_reference_code": "a330347242"
}
],
[
{
"sys_point_id": "84",
"sys_point_registration": "12345678",
"sys_point_day": "22",
"sys_point_month": "12",
"sys_point_year": "18",
"sys_point_hour": "02",
"sys_point_minute": "59",
"sys_point_geo_lat": "-5.0788858",
"sys_point_geo_long": "-42.8043689",
"sys_point_status": "Presença",
"sys_point_reference_code": "22f1d178ef"
}
]
]
}
Мой интерфейс такой
@FormUrlEncoded
@POST("point/list/")
Call<List<List<Value>>> listPointPeriod(@Field("token") String token,
@Field("registration") String registration,
@Field("from_date") String from_date,
@Field("to_date") String to_date);
Это называется
Call<List<List<Value>>> callPonto = api.listPontoPeriod(token, resultFuncionario.get(i).getOfficials_registration(), dtInicio, dtFim);
callPonto.enqueue(new Callback<List<List<Value>>>() {
@Override
public void onResponse(Call<List<List<Value>>> call, Response<List<List<Value>>> response) {
Gson gson = new Gson();
Type collectionType = new TypeToken<List<List<Ponto>>>(){}.getType();
List<Ponto> ponto = gson.fromJson(response.body().get(0).toString(), collectionType); }
@Override
public void onFailure(Call<List<List<Value>>> call, Throwable t) {
Log.d("error", t.getMessage());
}
});
Модель Ponto
public class Ponto {
String sys_point_id, sys_point_registration, sys_point_day, sys_point_month, sys_point_year, sys_point_hour, sys_point_minute,
sys_point_geo_lat, sys_point_geo_long, sys_point_status, sys_point_reference_code;
public Ponto(String sys_point_id, String sys_point_registration, String sys_point_day, String sys_point_month, String sys_point_year, String sys_point_hour, String sys_point_minute, String sys_point_geo_lat, String sys_point_geo_long, String sys_point_status, String sys_point_reference_code) {
this.sys_point_id = sys_point_id;
this.sys_point_registration = sys_point_registration;
this.sys_point_day = sys_point_day;
this.sys_point_month = sys_point_month;
this.sys_point_year = sys_point_year;
this.sys_point_hour = sys_point_hour;
this.sys_point_minute = sys_point_minute;
this.sys_point_geo_lat = sys_point_geo_lat;
this.sys_point_geo_long = sys_point_geo_long;
this.sys_point_status = sys_point_status;
this.sys_point_reference_code = sys_point_reference_code;
}
public Ponto(){
}
public String getSys_point_id() {
return sys_point_id;
}
public String getSys_point_registration() {
return sys_point_registration;
}
public String getSys_point_day() {
return sys_point_day;
}
public String getSys_point_month() {
return sys_point_month;
}
public String getSys_point_year() {
return sys_point_year;
}
public String getSys_point_hour() {
return sys_point_hour;
}
public String getSys_point_minute() {
return sys_point_minute;
}
public String getSys_point_geo_lat() {
return sys_point_geo_lat;
}
public String getSys_point_geo_long() {
return sys_point_geo_long;
}
public String getSys_point_status() {
return sys_point_status;
}
public String getSys_point_reference_code() {
return sys_point_reference_code;
}
}
мой класс значений
public class Value {List<Ponto> point_period_data;public List<Ponto>getPointPeriod() {return point_period_data}}
Как вы видели выше, мой код, я пытаюсь использовать этот json, я пытался несколькими способами этобыл последним, который я попробовал.Если у кого-то уже было это и есть какой-то ответ, чтобы решить эту проблему, пожалуйста, дайте мне знать.