Android - how to get json from retrofit
<p>I am new with Retrofit, </p>

<pre><code> [
  {
    "scheme_name": "DSP BlackRock Tax Saver Fund (G)",
    "sch_id": "401",
    "scheme_code": "D110",
    "category_type": "Equity",
    "trxntype": "Lumpsum",
    "current_value": 570.178,
    "folio_no": "3417548/62",
    "units": 14.941,
    "trnx_date": "10-06-16",
    "current_invest": 500,
    "gainLoss": 70.18
  },
  {
    "scheme_name": "DSP BlackRock World Mining Fund  (G)",
    "sch_id": "1278",
    "scheme_code": "D341",
    "category_type": "Equity",
    "trxntype": "Lumpsum",
    "current_value": 1999.393,
    "folio_no": "3417548/62",
    "units": 302.16,
    "trnx_date": "21-07-16",
    "current_invest": 2000,
    "gainLoss": -0.61
  },
  {
    "scheme_name": "ICICI Prudential Savings Fund (G)",
    "sch_id": "119",
    "scheme_code": "P1543",
    "category_type": "Debt",
    "trxntype": "Full Redemption",
    "current_value": 0,
    "folio_no": "8349201/28",
    "units": 0,
    "trnx_date": "19-07-16",
    "current_invest": 0,
    "gainLoss": 0
  },
  {
    "scheme_name": "Kotak Emerging Equity Scheme (G)",
    "sch_id": "1001",
    "scheme_code": "K123",
    "category_type": "Equity",
    "trxntype": "Lumpsum",
    "current_value": 10309.489,
    "folio_no": "3625427/38",
    "units": 325.796,
    "trnx_date": "03-08-16",
    "current_invest": 10000,
    "gainLoss": 309.49
  }
]
</code></pre>

<p>this is json is get, </p>

<pre><code> package info.androidhive.retrofit.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import javax.annotation.Generated;

@Generated("org.jsonschema2pojo")
public class MyTransaction {

    @SerializedName("scheme_name")
    @Expose
    private String schemeName;
    @SerializedName("sch_id")
    @Expose
    private String schId;
    @SerializedName("scheme_code")
    @Expose
    private String schemeCode;
    @SerializedName("category_type")
    @Expose
    private String categoryType;
    @SerializedName("trxntype")
    @Expose
    private String trxntype;
    @SerializedName("current_value")
    @Expose
    private Float currentValue;
    @SerializedName("folio_no")
    @Expose
    private String folioNo;
    @SerializedName("units")
    @Expose
    private Float units;
    @SerializedName("trnx_date")
    @Expose
    private String trnxDate;
    @SerializedName("current_invest")
    @Expose
    private Integer currentInvest;
    @SerializedName("gainLoss")
    @Expose
    private Float gainLoss;



    public MyTransaction(String schemeName, String schId, String schemeCode, String categoryType, String trxntype, Float currentValue, String folioNo, Float units, String trnxDate, Integer currentInvest, Float gainLoss) {
        this.schemeName = schemeName;
        this.schId = schId;
        this.schemeCode = schemeCode;
        this.categoryType = categoryType;
        this.trxntype = trxntype;
        this.currentValue = currentValue;
        this.folioNo = folioNo;
        this.units = units;
        this.trnxDate = trnxDate;
        this.currentInvest = currentInvest;
        this.gainLoss = gainLoss;
    }



    /**
     *
     * @return
     * The schemeName
     */
    public String getSchemeName() {
        return schemeName;
    }

    /**
     *
     * @param schemeName
     * The scheme_name
     */
    public void setSchemeName(String schemeName) {
        this.schemeName = schemeName;
    }

    /**
     *
     * @return
     * The schId
     */
    public String getSchId() {
        return schId;
    }

    /**
     *
     * @param schId
     * The sch_id
     */
    public void setSchId(String schId) {
        this.schId = schId;
    }

    /**
     *
     * @return
     * The schemeCode
     */
    public String getSchemeCode() {
        return schemeCode;
    }

    /**
     *
     * @param schemeCode
     * The scheme_code
     */
    public void setSchemeCode(String schemeCode) {
        this.schemeCode = schemeCode;
    }

    /**
     *
     * @return
     * The categoryType
     */
    public String getCategoryType() {
        return categoryType;
    }

    /**
     *
     * @param categoryType
     * The category_type
     */
    public void setCategoryType(String categoryType) {
        this.categoryType = categoryType;
    }

    /**
     *
     * @return
     * The trxntype
     */
    public String getTrxntype() {
        return trxntype;
    }

    /**
     *
     * @param trxntype
     * The trxntype
     */
    public void setTrxntype(String trxntype) {
        this.trxntype = trxntype;
    }

    /**
     *
     * @return
     * The currentValue
     */
    public Float getCurrentValue() {
        return currentValue;
    }

    /**
     *
     * @param currentValue
     * The current_value
     */
    public void setCurrentValue(Float currentValue) {
        this.currentValue = currentValue;
    }

    /**
     *
     * @return
     * The folioNo
     */
    public String getFolioNo() {
        return folioNo;
    }

    /**
     *
     * @param folioNo
     * The folio_no
     */
    public void setFolioNo(String folioNo) {
        this.folioNo = folioNo;
    }

    /**
     *
     * @return
     * The units
     */
    public Float getUnits() {
        return units;
    }

    /**
     *
     * @param units
     * The units
     */
    public void setUnits(Float units) {
        this.units = units;
    }

    /**
     *
     * @return
     * The trnxDate
     */
    public String getTrnxDate() {
        return trnxDate;
    }

    /**
     *
     * @param trnxDate
     * The trnx_date
     */
    public void setTrnxDate(String trnxDate) {
        this.trnxDate = trnxDate;
    }

    /**
     *
     * @return
     * The currentInvest
     */
    public Integer getCurrentInvest() {
        return currentInvest;
    }

    /**
     *
     * @param currentInvest
     * The current_invest
     */
    public void setCurrentInvest(Integer currentInvest) {
        this.currentInvest = currentInvest;
    }

    /**
     *
     * @return
     * The gainLoss
     */
    public Float getGainLoss() {
        return gainLoss;
    }

    /**
     *
     * @param gainLoss
     * The gainLoss
     */
    public void setGainLoss(Float gainLoss) {
        this.gainLoss = gainLoss;
    }

}
</code></pre>

<p>Above is model class.
Api Client code</p>

<pre><code>    public static final String BASE_URL = "http://www.mysiponline.com/admin-panel/AndroidApi/";
    private static Retrofit retrofit = null;

    public static Retrofit getClient() {
        if (retrofit==null) {
            retrofit = new Retrofit.Builder()
                    .baseUrl(BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();
        }
        return retrofit;
    }
</code></pre>

<p>AIPinterfae code </p>

<pre><code>     @POST("client_trans/{user_id}")
    Call&lt;MyTransaction&gt; getTransaction(@Path("user_id") String id);
</code></pre>

<p>MainActivity code</p>

<pre><code>    Call&lt;MyTransaction&gt; myTransactionCall = apiService.getTransaction("420");
        myTransactionCall.enqueue(new Callback&lt;MyTransaction&gt;() {
            @Override
            public void onResponse(Call&lt;MyTransaction&gt; call, Response&lt;MyTransaction&gt; response) {

                Log.e(TAG, "Partners list : response.body());
            }

            @Override
            public void onFailure(Call&lt;MyTransaction&gt; call, Throwable t) {

            }
        });
</code></pre>

<p>In mainActivity code getting error. I am not able to get it. Please help and thanks in advance.</p>

<pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NullPointerException
at info.androidhive.retrofit.activity.MainActivity$2.onResponse(MainActivity.java:65)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
</code></pre>