How to create custom GsonConverter from following response?

Use these Model classes and pass your response directly through Gson

com.example.ACCESSORIES.java

package com.example;

import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class ACCESSORIES {

    @SerializedName("accessories")
    @Expose
    private List<Accessory> accessories = null;

    public List<Accessory> getAccessories() {
        return accessories;
    }

    public void setAccessories(List<Accessory> accessories) {
        this.accessories = accessories;
    }
}

com.example.Accessory.java

package com.example;

import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Accessory {

    @SerializedName("SHOP BY CATEGORY")
    @Expose
    private List<SHOPBYCATEGORY> sHOPBYCATEGORY = null;
    @SerializedName("SHOP BY MATERIAL")
    @Expose
    private List<SHOPBYMATERIAL> sHOPBYMATERIAL = null;
    @SerializedName("SHOP BY COLOR")
    @Expose
    private List<SHOPBYCOLOR> sHOPBYCOLOR = null;
    @SerializedName("SHOP BY PRODUCT TYPE")
    @Expose
    private List<SHOPBYPRODUCTTYPE> sHOPBYPRODUCTTYPE = null;
    @SerializedName("SHOP BY PRICE")
    @Expose
    private List<SHOPBYPRICE> sHOPBYPRICE = null;

    public List<SHOPBYCATEGORY> getSHOPBYCATEGORY() {
        return sHOPBYCATEGORY;
    }

    public void setSHOPBYCATEGORY(List<SHOPBYCATEGORY> sHOPBYCATEGORY) {
        this.sHOPBYCATEGORY = sHOPBYCATEGORY;
    }

    public List<SHOPBYMATERIAL> getSHOPBYMATERIAL() {
        return sHOPBYMATERIAL;
    }

    public void setSHOPBYMATERIAL(List<SHOPBYMATERIAL> sHOPBYMATERIAL) {
        this.sHOPBYMATERIAL = sHOPBYMATERIAL;
    }

    public List<SHOPBYCOLOR> getSHOPBYCOLOR() {
        return sHOPBYCOLOR;
    }

    public void setSHOPBYCOLOR(List<SHOPBYCOLOR> sHOPBYCOLOR) {
        this.sHOPBYCOLOR = sHOPBYCOLOR;
    }

    public List<SHOPBYPRODUCTTYPE> getSHOPBYPRODUCTTYPE() {
        return sHOPBYPRODUCTTYPE;
    }

    public void setSHOPBYPRODUCTTYPE(List<SHOPBYPRODUCTTYPE> sHOPBYPRODUCTTYPE) {
        this.sHOPBYPRODUCTTYPE = sHOPBYPRODUCTTYPE;
    }

    public List<SHOPBYPRICE> getSHOPBYPRICE() {
        return sHOPBYPRICE;
    }

    public void setSHOPBYPRICE(List<SHOPBYPRICE> sHOPBYPRICE) {
        this.sHOPBYPRICE = sHOPBYPRICE;
    }
}

com.example.Example.java

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Example {

    @SerializedName("NEW ARRIVALS")
    @Expose
    private NEWARRIVALS nEWARRIVALS;
    @SerializedName("ACCESSORIES")
    @Expose
    private ACCESSORIES aCCESSORIES;

    public NEWARRIVALS getNEWARRIVALS() {
        return nEWARRIVALS;
    }

    public void setNEWARRIVALS(NEWARRIVALS nEWARRIVALS) {
        this.nEWARRIVALS = nEWARRIVALS;
    }

    public ACCESSORIES getACCESSORIES() {
        return aCCESSORIES;
    }

    public void setACCESSORIES(ACCESSORIES aCCESSORIES) {
        this.aCCESSORIES = aCCESSORIES;
    }
}

com.example.NEWARRIVALS.java

package com.example;

import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class NEWARRIVALS {

    @SerializedName("new-arrivals")
    @Expose
    private List<Object> newArrivals = null;

    public List<Object> getNewArrivals() {
        return newArrivals;
    }

    public void setNewArrivals(List<Object> newArrivals) {
        this.newArrivals = newArrivals;
    }
}

com.example.SHOPBYCATEGORY.java

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class SHOPBYCATEGORY {

    @SerializedName("Earrings")
    @Expose
    private String earrings;
    @SerializedName("Necklace & Pendent Sets")
    @Expose
    private String necklacePendentSets;
    @SerializedName("Blouses")
    @Expose
    private String blouses;
    @SerializedName("Bottom Wear")
    @Expose
    private String bottomWear;
    @SerializedName("Duppattas")
    @Expose
    private String duppattas;
    @SerializedName("...View all")
    @Expose
    private String viewAll;

    public String getEarrings() {
        return earrings;
    }

    public void setEarrings(String earrings) {
        this.earrings = earrings;
    }

    public String getNecklacePendentSets() {
        return necklacePendentSets;
    }

    public void setNecklacePendentSets(String necklacePendentSets) {
        this.necklacePendentSets = necklacePendentSets;
    }

    public String getBlouses() {
        return blouses;
    }

    public void setBlouses(String blouses) {
        this.blouses = blouses;
    }

    public String getBottomWear() {
        return bottomWear;
    }

    public void setBottomWear(String bottomWear) {
        this.bottomWear = bottomWear;
    }

    public String getDuppattas() {
        return duppattas;
    }

    public void setDuppattas(String duppattas) {
        this.duppattas = duppattas;
    }

    public String getViewAll() {
        return viewAll;
    }

    public void setViewAll(String viewAll) {
        this.viewAll = viewAll;
    }
}

com.example.SHOPBYCOLOR.java

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class SHOPBYCOLOR {

    @SerializedName("White")
    @Expose
    private String white;
    @SerializedName("Blue")
    @Expose
    private String blue;
    @SerializedName("Black")
    @Expose
    private String black;
    @SerializedName("Green")
    @Expose
    private String green;
    @SerializedName("Pink")
    @Expose
    private String pink;
    @SerializedName("Beige")
    @Expose
    private String beige;
    @SerializedName("Red")
    @Expose
    private String red;
    @SerializedName("Yellow")
    @Expose
    private String yellow;
    @SerializedName("Orange")
    @Expose
    private String orange;
    @SerializedName("...View all")
    @Expose
    private String viewAll;

    public String getWhite() {
        return white;
    }

    public void setWhite(String white) {
        this.white = white;
    }

    public String getBlue() {
        return blue;
    }

    public void setBlue(String blue) {
        this.blue = blue;
    }

    public String getBlack() {
        return black;
    }

    public void setBlack(String black) {
        this.black = black;
    }

    public String getGreen() {
        return green;
    }

    public void setGreen(String green) {
        this.green = green;
    }

    public String getPink() {
        return pink;
    }

    public void setPink(String pink) {
        this.pink = pink;
    }

    public String getBeige() {
        return beige;
    }

    public void setBeige(String beige) {
        this.beige = beige;
    }

    public String getRed() {
        return red;
    }

    public void setRed(String red) {
        this.red = red;
    }

    public String getYellow() {
        return yellow;
    }

    public void setYellow(String yellow) {
        this.yellow = yellow;
    }

    public String getOrange() {
        return orange;
    }

    public void setOrange(String orange) {
        this.orange = orange;
    }

    public String getViewAll() {
        return viewAll;
    }

    public void setViewAll(String viewAll) {
        this.viewAll = viewAll;
    }
}

com.example.SHOPBYMATERIAL.java

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class SHOPBYMATERIAL {

    @SerializedName("Crape")
    @Expose
    private String crape;
    @SerializedName("Silk")
    @Expose
    private String silk;
    @SerializedName("Chanderi")
    @Expose
    private String chanderi;
    @SerializedName("Bhagalpuri")
    @Expose
    private String bhagalpuri;

    public String getCrape() {
        return crape;
    }

    public void setCrape(String crape) {
        this.crape = crape;
    }

    public String getSilk() {
        return silk;
    }

    public void setSilk(String silk) {
        this.silk = silk;
    }

    public String getChanderi() {
        return chanderi;
    }

    public void setChanderi(String chanderi) {
        this.chanderi = chanderi;
    }

    public String getBhagalpuri() {
        return bhagalpuri;
    }

    public void setBhagalpuri(String bhagalpuri) {
        this.bhagalpuri = bhagalpuri;
    }
}

com.example.SHOPBYPRICE.java

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class SHOPBYPRICE {

    @SerializedName("Rs.0 - Rs.499")
    @Expose
    private String rs0Rs499;
    @SerializedName("Rs.500 - Rs.999")
    @Expose
    private String rs500Rs999;
    @SerializedName("Rs.1000 - Rs.1499")
    @Expose
    private String rs1000Rs1499;
    @SerializedName("Rs.1500 - Rs.1999")
    @Expose
    private String rs1500Rs1999;
    @SerializedName("Rs.2000 and above")
    @Expose
    private String rs2000AndAbove;
    @SerializedName("...View all")
    @Expose
    private String viewAll;

    public String getRs0Rs499() {
        return rs0Rs499;
    }

    public void setRs0Rs499(String rs0Rs499) {
        this.rs0Rs499 = rs0Rs499;
    }

    public String getRs500Rs999() {
        return rs500Rs999;
    }

    public void setRs500Rs999(String rs500Rs999) {
        this.rs500Rs999 = rs500Rs999;
    }

    public String getRs1000Rs1499() {
        return rs1000Rs1499;
    }

    public void setRs1000Rs1499(String rs1000Rs1499) {
        this.rs1000Rs1499 = rs1000Rs1499;
    }

    public String getRs1500Rs1999() {
        return rs1500Rs1999;
    }

    public void setRs1500Rs1999(String rs1500Rs1999) {
        this.rs1500Rs1999 = rs1500Rs1999;
    }

    public String getRs2000AndAbove() {
        return rs2000AndAbove;
    }

    public void setRs2000AndAbove(String rs2000AndAbove) {
        this.rs2000AndAbove = rs2000AndAbove;
    }

    public String getViewAll() {
        return viewAll;
    }

    public void setViewAll(String viewAll) {
        this.viewAll = viewAll;
    }
}

com.example.SHOPBYPRODUCTTYPE.java

package com.example;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class SHOPBYPRODUCTTYPE {

    @SerializedName("Accessories")
    @Expose
    private String accessories;
    @SerializedName("Stitched")
    @Expose
    private String stitched;

    public String getAccessories() {
        return accessories;
    }

    public void setAccessories(String accessories) {
        this.accessories = accessories;
    }

    public String getStitched() {
        return stitched;
    }

    public void setStitched(String stitched) {
        this.stitched = stitched;
    }
}

Leave a Comment