Я новичок в Android, я хочу получить этот JSON из Amazon DynamoDB, я использовал retrofit2 для извлечения этих данных из Amazon DynamoDB. Пожалуйста, помогите мне получить файл Output.JSON, содержащий несколько ArrayList.
{
"configContent": {
"addressTypes": [
"Home",
"Work"
],
"firstTimeInterval": 1,
"gender": [
"Male",
"Female",
"Trans-Female",
"Bi-Gender",
"Non-Binary",
"Gender nonconfirming",
"Undisclosed",
"Rather not say"
],
"languages": [
"English",
"Spanish",
"Marathi",
"Hindi",
"Bengali",
"French",
"Arabic",
"German",
"Italian",
"Dutch",
"Japanese",
"Russia",
"Korean"
],
"mapResetTimeInterval": 30,
"meetingTrackableTime": 3600,
"meetmeSearchContactTimeInterval": 2,
"numberOfParticipants": 8,
"profileToastDelatimebysix": 6,
"profileToastDelayTime": 4,
"secondTimeInterval": 2,
"signupToastdelatimebysix": 6,
"signupToastDelayMedium": 5,
"signupToastDelayTime": 4,
"syncToastMaxTimeInterval": 300,
"syncToastThirdTimeInterval": 180,
"toastDelayTimeForPulse": 3,
"trackingOptions": [
{
"isDeleted": 0,
"isTimeRequired": 1,
"optionName": "Before the meet",
"trackingTime": [
5,
10,
15
]
},
{
"isDeleted": 0,
"isTimeRequired": 1,
"optionName": "After the meet",
"trackingTime": [
5,
10,
15
]
},
{
"isDeleted": 0,
"isTimeRequired": 0,
"optionName": "At the start",
"trackingTime": []
},
{
"isDeleted": 0,
"isTimeRequired": 0,
"optionName": "Never",
"trackingTime": []
}
],
"transportModes": [
"Walking",
"Driving"
]
},
"createdDate": "2018-04-17T10:53:50.721Z",
"id": "bb52dc0f-29d0-4079-99c7-a07c8045a829",
"moduleName": "MeetMe"
}
Это интерфейс
public interface Api {
String BASE_URL = "https://sz3i35gurk.execute-api.eu-west-2.amazonaws.com/dev/";
@GET("meetmeconfigurations")
Call<Hero> getHeroes();
POJO CLASS
Hero.class
public class Hero {
private String id;
private ConfigContent configContent;
private String moduleName;
private String createdDate;
}
ConfigContent.class
public class ConfigContent {
private String mapResetTimeInterval;
private String signupToastdelatimebysix;
private String toastDelayTimeForPulse;
private String profileToastDelatimebysix;
private TrackingOptions[] trackingOptions;
private String firstTimeInterval;
private String signupToastDelayTime;
private String meetingTrackableTime;
private String[] addressTypes;
private String[] languages;
private String signupToastDelayMedium;
private String numberOfParticipants;
private String syncToastMaxTimeInterval;
private String syncToastThirdTimeInterval;
private String profileToastDelayTime;
private String[] gender;
private String meetmeSearchContactTimeInterval;
private String[] transportModes;
private String secondTimeInterval;
}
TrackingOption.class
public class TrackingOptions {
private String optionName;
private String isTimeRequired;
private String isDeleted;
private String[] trackingTime;
}
Файл MainActivity
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(Api.BASE_URL)
.addConverterFactory(GsonConverterFactory.create()) //Here we are using the GsonConverterFactory to directly convert json data to object
.build();
Api api = retrofit.create(Api.class);
Call<Hero> call = api.getHeroes();
call.enqueue(new Callback<Hero>() {
@Override
public void onResponse(Call<Hero> call, Response<Hero> response) {
Hero heroList = response.body();
data = new ArrayList<>(Arrays.asList(heroList));
Log.d("Data","Data recevied:"+data);
}
@Override
public void onFailure(Call<Hero> call, Throwable t) {
Log.d("error message","error message"+t);
Toast.makeText(getApplicationContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
Поэтому, когда я запускаю программу, я получаю нулевое значение, пожалуйста, помогите решить проблему