i'm doing an http call using the new retrofit 2.0, and getting a callback, i want to use gson 2.0 library to parse that json obj and to be able to do
jsonData.sector[2].sectorOne
this is my callback:
retrofitApi.Factory.getInstance().getCallData().enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Log.d("myLogs", "failed to Retrive Data");
Log.d("myLogs", "becouse: "+t);
largeTextVar.setText("failed: " + t);
}
});
this is how my callback will look like
{
"data": {
"sector": [
[
{
"scanned": false,
"sectorOne": "",
"sectorTwo": "",
"sectorThree": ""
},
{
"scanned": false,
"sectorOne": "",
"sectorTwo": "",
"sectorThree": ""
}
]
]
},
"curserLocation": {
"elevation": 30,
"horizontal": 105
}
}
i'm using :
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
i looked everywhere on how to do this, but i couldn't find a simple solution for this, what is the simplest, easiest way to achieve this ?