mercredi 13 juillet 2016

Get Retrofit result as Json Object in Android

I am using Retrofit API for communication. I want JSON Object to be stored directly in the Retrofit Result Bean. I tried the below process and it produced in null value. but while using postman the result is proper only.

The below is the output of the API

{
  "status": 101,
  "message": "Ok",
  "type": 1,
  "data": {
    "value": "adakdj4lkj43"
  }
}

The data field above keeps on changing as per the input in one case value on other case date this data depends on the type

below is my ResponseBean

public class ResponseBean {
    private int status = 0;
    private String message = "";
    private int type = 0;
    private JSONObject data = new JSONObject();
}

When performing the retrofit call I am getting this data as {} which means there is no data. Please help me to solve this. Thanks in Advance.

Aucun commentaire:

Enregistrer un commentaire