How to retrieve jsonObject inside jsonArray using GSON in android
I am retrieving data from API and accessing the data using GSON. I have an array of data coming from API and it also contains an object in it.
Data Example:
{
"data": [
{
"id": 3,
"company_id": "1",
"name_nl": "Showtrap trapreno laminaat Kahlua 2 treden Karwei 42x23x25cm",
"description": "",
"name_fr": "=ESCALIER DEMO MELAMINE 2MARCHES===",
"ean_code": "8711283406329",
"mbh": "1",
"msrp": "75",
"article_code": "00076",
"article_status": "nazorg",
"source": "Products",
"created_at": "2018-09-14 11:43:57",
"updated_at": "2018-09-14 11:43:57",
"company": {
"id": 1,
"name": "JEWE",
"franco_amount_product": "1500",
"mail_product": "jewehq@expertmedia.be",
"status": "A",
"created_at": "2018-07-06 04:06:08",
"updated_at": "2018-10-23 14:07:59"
}
}
]
}
I have generated Plain Old Java Objects from JSON and got 2 files datum.java that contains all fields of data array except fields from company object. And one Company.java that contains all fields from Company object.
I have one method in datum.java to access Company object i.e.
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
And Company.java
@SerializedName("name")
@Expose
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
like this I have created my model. I am able to get all fields of data array but I am not able to understand how can I access company object from data array using GSON.
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setDateFormat("M/d/yy hh:mm a");
gson = gsonBuilder.create();
JSONArray jsonArray = response.getJSONArray("data");
if (jsonArray.length() > 0) {
List<Datum> datumArrayList = new ArrayList<>();
datumArrayList = Arrays.asList(gson.fromJson(jsonArray.toString(), Datum.class));
Log.e("TAG", "onResponse:datumArrayList "+datumArrayList.size() );
for(Datum datum : datumArrayList){
Log.e("TAG", "onResponse: "+datum.getCompany() );
}
I want to get franco_amount_product from company object. How can I get Please help.
//Edit .
JSONArray jsonArray = response.getJSONArray("data");
if (jsonArray.length() > 0) {
List<Datum> datumArrayList = new ArrayList<>();
datumArrayList = Arrays.asList(gson.fromJson(jsonArray.toString(), Datum.class));
Log.e("TAG", "onResponse:datumArrayList "+datumArrayList.size() );
ProductDetailsModel model = ProductDetailsModel.fromJson("data");
model.setData(datumArrayList);
for(Datum datum : model.getData()){
Log.e("TAG", "onResponse: " + datum.getCompany().getFrancoAmountProduct() + ""+datum.getEanCode());
}
I have edited my code but not able to get any values now. How can I access values from both data and company as I need to save combined data in database
android json gson
add a comment |
I am retrieving data from API and accessing the data using GSON. I have an array of data coming from API and it also contains an object in it.
Data Example:
{
"data": [
{
"id": 3,
"company_id": "1",
"name_nl": "Showtrap trapreno laminaat Kahlua 2 treden Karwei 42x23x25cm",
"description": "",
"name_fr": "=ESCALIER DEMO MELAMINE 2MARCHES===",
"ean_code": "8711283406329",
"mbh": "1",
"msrp": "75",
"article_code": "00076",
"article_status": "nazorg",
"source": "Products",
"created_at": "2018-09-14 11:43:57",
"updated_at": "2018-09-14 11:43:57",
"company": {
"id": 1,
"name": "JEWE",
"franco_amount_product": "1500",
"mail_product": "jewehq@expertmedia.be",
"status": "A",
"created_at": "2018-07-06 04:06:08",
"updated_at": "2018-10-23 14:07:59"
}
}
]
}
I have generated Plain Old Java Objects from JSON and got 2 files datum.java that contains all fields of data array except fields from company object. And one Company.java that contains all fields from Company object.
I have one method in datum.java to access Company object i.e.
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
And Company.java
@SerializedName("name")
@Expose
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
like this I have created my model. I am able to get all fields of data array but I am not able to understand how can I access company object from data array using GSON.
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setDateFormat("M/d/yy hh:mm a");
gson = gsonBuilder.create();
JSONArray jsonArray = response.getJSONArray("data");
if (jsonArray.length() > 0) {
List<Datum> datumArrayList = new ArrayList<>();
datumArrayList = Arrays.asList(gson.fromJson(jsonArray.toString(), Datum.class));
Log.e("TAG", "onResponse:datumArrayList "+datumArrayList.size() );
for(Datum datum : datumArrayList){
Log.e("TAG", "onResponse: "+datum.getCompany() );
}
I want to get franco_amount_product from company object. How can I get Please help.
//Edit .
JSONArray jsonArray = response.getJSONArray("data");
if (jsonArray.length() > 0) {
List<Datum> datumArrayList = new ArrayList<>();
datumArrayList = Arrays.asList(gson.fromJson(jsonArray.toString(), Datum.class));
Log.e("TAG", "onResponse:datumArrayList "+datumArrayList.size() );
ProductDetailsModel model = ProductDetailsModel.fromJson("data");
model.setData(datumArrayList);
for(Datum datum : model.getData()){
Log.e("TAG", "onResponse: " + datum.getCompany().getFrancoAmountProduct() + ""+datum.getEanCode());
}
I have edited my code but not able to get any values now. How can I access values from both data and company as I need to save combined data in database
android json gson
Have you generated the Gson model calsses using jsonschema2pojo.org?
– aminography
Nov 15 '18 at 8:24
yes @aminography
– mishti
Nov 15 '18 at 8:35
add a comment |
I am retrieving data from API and accessing the data using GSON. I have an array of data coming from API and it also contains an object in it.
Data Example:
{
"data": [
{
"id": 3,
"company_id": "1",
"name_nl": "Showtrap trapreno laminaat Kahlua 2 treden Karwei 42x23x25cm",
"description": "",
"name_fr": "=ESCALIER DEMO MELAMINE 2MARCHES===",
"ean_code": "8711283406329",
"mbh": "1",
"msrp": "75",
"article_code": "00076",
"article_status": "nazorg",
"source": "Products",
"created_at": "2018-09-14 11:43:57",
"updated_at": "2018-09-14 11:43:57",
"company": {
"id": 1,
"name": "JEWE",
"franco_amount_product": "1500",
"mail_product": "jewehq@expertmedia.be",
"status": "A",
"created_at": "2018-07-06 04:06:08",
"updated_at": "2018-10-23 14:07:59"
}
}
]
}
I have generated Plain Old Java Objects from JSON and got 2 files datum.java that contains all fields of data array except fields from company object. And one Company.java that contains all fields from Company object.
I have one method in datum.java to access Company object i.e.
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
And Company.java
@SerializedName("name")
@Expose
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
like this I have created my model. I am able to get all fields of data array but I am not able to understand how can I access company object from data array using GSON.
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setDateFormat("M/d/yy hh:mm a");
gson = gsonBuilder.create();
JSONArray jsonArray = response.getJSONArray("data");
if (jsonArray.length() > 0) {
List<Datum> datumArrayList = new ArrayList<>();
datumArrayList = Arrays.asList(gson.fromJson(jsonArray.toString(), Datum.class));
Log.e("TAG", "onResponse:datumArrayList "+datumArrayList.size() );
for(Datum datum : datumArrayList){
Log.e("TAG", "onResponse: "+datum.getCompany() );
}
I want to get franco_amount_product from company object. How can I get Please help.
//Edit .
JSONArray jsonArray = response.getJSONArray("data");
if (jsonArray.length() > 0) {
List<Datum> datumArrayList = new ArrayList<>();
datumArrayList = Arrays.asList(gson.fromJson(jsonArray.toString(), Datum.class));
Log.e("TAG", "onResponse:datumArrayList "+datumArrayList.size() );
ProductDetailsModel model = ProductDetailsModel.fromJson("data");
model.setData(datumArrayList);
for(Datum datum : model.getData()){
Log.e("TAG", "onResponse: " + datum.getCompany().getFrancoAmountProduct() + ""+datum.getEanCode());
}
I have edited my code but not able to get any values now. How can I access values from both data and company as I need to save combined data in database
android json gson
I am retrieving data from API and accessing the data using GSON. I have an array of data coming from API and it also contains an object in it.
Data Example:
{
"data": [
{
"id": 3,
"company_id": "1",
"name_nl": "Showtrap trapreno laminaat Kahlua 2 treden Karwei 42x23x25cm",
"description": "",
"name_fr": "=ESCALIER DEMO MELAMINE 2MARCHES===",
"ean_code": "8711283406329",
"mbh": "1",
"msrp": "75",
"article_code": "00076",
"article_status": "nazorg",
"source": "Products",
"created_at": "2018-09-14 11:43:57",
"updated_at": "2018-09-14 11:43:57",
"company": {
"id": 1,
"name": "JEWE",
"franco_amount_product": "1500",
"mail_product": "jewehq@expertmedia.be",
"status": "A",
"created_at": "2018-07-06 04:06:08",
"updated_at": "2018-10-23 14:07:59"
}
}
]
}
I have generated Plain Old Java Objects from JSON and got 2 files datum.java that contains all fields of data array except fields from company object. And one Company.java that contains all fields from Company object.
I have one method in datum.java to access Company object i.e.
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
And Company.java
@SerializedName("name")
@Expose
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
like this I have created my model. I am able to get all fields of data array but I am not able to understand how can I access company object from data array using GSON.
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setDateFormat("M/d/yy hh:mm a");
gson = gsonBuilder.create();
JSONArray jsonArray = response.getJSONArray("data");
if (jsonArray.length() > 0) {
List<Datum> datumArrayList = new ArrayList<>();
datumArrayList = Arrays.asList(gson.fromJson(jsonArray.toString(), Datum.class));
Log.e("TAG", "onResponse:datumArrayList "+datumArrayList.size() );
for(Datum datum : datumArrayList){
Log.e("TAG", "onResponse: "+datum.getCompany() );
}
I want to get franco_amount_product from company object. How can I get Please help.
//Edit .
JSONArray jsonArray = response.getJSONArray("data");
if (jsonArray.length() > 0) {
List<Datum> datumArrayList = new ArrayList<>();
datumArrayList = Arrays.asList(gson.fromJson(jsonArray.toString(), Datum.class));
Log.e("TAG", "onResponse:datumArrayList "+datumArrayList.size() );
ProductDetailsModel model = ProductDetailsModel.fromJson("data");
model.setData(datumArrayList);
for(Datum datum : model.getData()){
Log.e("TAG", "onResponse: " + datum.getCompany().getFrancoAmountProduct() + ""+datum.getEanCode());
}
I have edited my code but not able to get any values now. How can I access values from both data and company as I need to save combined data in database
android json gson
android json gson
edited Feb 4 at 19:59
Community♦
11
11
asked Nov 15 '18 at 7:38
mishtimishti
386
386
Have you generated the Gson model calsses using jsonschema2pojo.org?
– aminography
Nov 15 '18 at 8:24
yes @aminography
– mishti
Nov 15 '18 at 8:35
add a comment |
Have you generated the Gson model calsses using jsonschema2pojo.org?
– aminography
Nov 15 '18 at 8:24
yes @aminography
– mishti
Nov 15 '18 at 8:35
Have you generated the Gson model calsses using jsonschema2pojo.org?
– aminography
Nov 15 '18 at 8:24
Have you generated the Gson model calsses using jsonschema2pojo.org?
– aminography
Nov 15 '18 at 8:24
yes @aminography
– mishti
Nov 15 '18 at 8:35
yes @aminography
– mishti
Nov 15 '18 at 8:35
add a comment |
2 Answers
2
active
oldest
votes
your Datum.java
should be like,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Datum {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("company_id")
@Expose
private String companyId;
@SerializedName("name_nl")
@Expose
private String nameNl;
@SerializedName("description")
@Expose
private String description;
@SerializedName("name_fr")
@Expose
private String nameFr;
@SerializedName("ean_code")
@Expose
private String eanCode;
@SerializedName("mbh")
@Expose
private String mbh;
@SerializedName("msrp")
@Expose
private String msrp;
@SerializedName("article_code")
@Expose
private String articleCode;
@SerializedName("article_status")
@Expose
private String articleStatus;
@SerializedName("source")
@Expose
private String source;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
@SerializedName("company")
@Expose
private Company company;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getNameNl() {
return nameNl;
}
public void setNameNl(String nameNl) {
this.nameNl = nameNl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getNameFr() {
return nameFr;
}
public void setNameFr(String nameFr) {
this.nameFr = nameFr;
}
public String getEanCode() {
return eanCode;
}
public void setEanCode(String eanCode) {
this.eanCode = eanCode;
}
public String getMbh() {
return mbh;
}
public void setMbh(String mbh) {
this.mbh = mbh;
}
public String getMsrp() {
return msrp;
}
public void setMsrp(String msrp) {
this.msrp = msrp;
}
public String getArticleCode() {
return articleCode;
}
public void setArticleCode(String articleCode) {
this.articleCode = articleCode;
}
public String getArticleStatus() {
return articleStatus;
}
public void setArticleStatus(String articleStatus) {
this.articleStatus = articleStatus;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
}
Your Company.java
,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Company {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("franco_amount_product")
@Expose
private String francoAmountProduct;
@SerializedName("mail_product")
@Expose
private String mailProduct;
@SerializedName("status")
@Expose
private String status;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFrancoAmountProduct() {
return francoAmountProduct;
}
public void setFrancoAmountProduct(String francoAmountProduct) {
this.francoAmountProduct = francoAmountProduct;
}
public String getMailProduct() {
return mailProduct;
}
public void setMailProduct(String mailProduct) {
this.mailProduct = mailProduct;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
}
Create ResponseModel.java
like,
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
}
Then get your Company object as below,
Gson gson = new Gson();
ResponseModel responseModel = gson.fromJson(jsonStr,ResponseModel.class);
for (int i=0;i<responseModel.getData().size();i++){
Company company = responseModel.getData().get(i).getCompany();
}
what is get(0) all about?
– mishti
Nov 15 '18 at 8:56
there will be for loop on your "data" jsonArray, I have edited my code.
– Shreya Prajapati
Nov 15 '18 at 9:01
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
It is your API response string
– Shreya Prajapati
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 1 more comment
You should create a model class for the response which handles the whole json string:
ResponseModel.java
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
public static ResponseModel fromJson(String json) {
return new Gson().fromJson(json, ResponseModel.class);
}
}
Now you can use it like following to parse the json string:
ResponseModel model = ResponseModel.fromJson(jsonString);
// for example for item 0:
String francoAmountProduct = model.getData().get(0).getCompany().getFrancoAmountProduct();
In a for loop like question content:
for(Datum datum : model.getData()){
Log.e("TAG", "onResponse: " + datum.getCompany().getFrancoAmountProduct());
}
get(0) --- what is 0 all about?
– mishti
Nov 15 '18 at 8:56
Your response contains a list ofDatum
objects. I get the 0-th element for example to show how to achieve thefrancoAmountProduct
.
– aminography
Nov 15 '18 at 9:04
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
jsonString
is response of your webservice call, exactly first block string in your question which you titled it: Data Example
– aminography
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314499%2fhow-to-retrieve-jsonobject-inside-jsonarray-using-gson-in-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
your Datum.java
should be like,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Datum {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("company_id")
@Expose
private String companyId;
@SerializedName("name_nl")
@Expose
private String nameNl;
@SerializedName("description")
@Expose
private String description;
@SerializedName("name_fr")
@Expose
private String nameFr;
@SerializedName("ean_code")
@Expose
private String eanCode;
@SerializedName("mbh")
@Expose
private String mbh;
@SerializedName("msrp")
@Expose
private String msrp;
@SerializedName("article_code")
@Expose
private String articleCode;
@SerializedName("article_status")
@Expose
private String articleStatus;
@SerializedName("source")
@Expose
private String source;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
@SerializedName("company")
@Expose
private Company company;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getNameNl() {
return nameNl;
}
public void setNameNl(String nameNl) {
this.nameNl = nameNl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getNameFr() {
return nameFr;
}
public void setNameFr(String nameFr) {
this.nameFr = nameFr;
}
public String getEanCode() {
return eanCode;
}
public void setEanCode(String eanCode) {
this.eanCode = eanCode;
}
public String getMbh() {
return mbh;
}
public void setMbh(String mbh) {
this.mbh = mbh;
}
public String getMsrp() {
return msrp;
}
public void setMsrp(String msrp) {
this.msrp = msrp;
}
public String getArticleCode() {
return articleCode;
}
public void setArticleCode(String articleCode) {
this.articleCode = articleCode;
}
public String getArticleStatus() {
return articleStatus;
}
public void setArticleStatus(String articleStatus) {
this.articleStatus = articleStatus;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
}
Your Company.java
,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Company {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("franco_amount_product")
@Expose
private String francoAmountProduct;
@SerializedName("mail_product")
@Expose
private String mailProduct;
@SerializedName("status")
@Expose
private String status;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFrancoAmountProduct() {
return francoAmountProduct;
}
public void setFrancoAmountProduct(String francoAmountProduct) {
this.francoAmountProduct = francoAmountProduct;
}
public String getMailProduct() {
return mailProduct;
}
public void setMailProduct(String mailProduct) {
this.mailProduct = mailProduct;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
}
Create ResponseModel.java
like,
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
}
Then get your Company object as below,
Gson gson = new Gson();
ResponseModel responseModel = gson.fromJson(jsonStr,ResponseModel.class);
for (int i=0;i<responseModel.getData().size();i++){
Company company = responseModel.getData().get(i).getCompany();
}
what is get(0) all about?
– mishti
Nov 15 '18 at 8:56
there will be for loop on your "data" jsonArray, I have edited my code.
– Shreya Prajapati
Nov 15 '18 at 9:01
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
It is your API response string
– Shreya Prajapati
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 1 more comment
your Datum.java
should be like,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Datum {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("company_id")
@Expose
private String companyId;
@SerializedName("name_nl")
@Expose
private String nameNl;
@SerializedName("description")
@Expose
private String description;
@SerializedName("name_fr")
@Expose
private String nameFr;
@SerializedName("ean_code")
@Expose
private String eanCode;
@SerializedName("mbh")
@Expose
private String mbh;
@SerializedName("msrp")
@Expose
private String msrp;
@SerializedName("article_code")
@Expose
private String articleCode;
@SerializedName("article_status")
@Expose
private String articleStatus;
@SerializedName("source")
@Expose
private String source;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
@SerializedName("company")
@Expose
private Company company;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getNameNl() {
return nameNl;
}
public void setNameNl(String nameNl) {
this.nameNl = nameNl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getNameFr() {
return nameFr;
}
public void setNameFr(String nameFr) {
this.nameFr = nameFr;
}
public String getEanCode() {
return eanCode;
}
public void setEanCode(String eanCode) {
this.eanCode = eanCode;
}
public String getMbh() {
return mbh;
}
public void setMbh(String mbh) {
this.mbh = mbh;
}
public String getMsrp() {
return msrp;
}
public void setMsrp(String msrp) {
this.msrp = msrp;
}
public String getArticleCode() {
return articleCode;
}
public void setArticleCode(String articleCode) {
this.articleCode = articleCode;
}
public String getArticleStatus() {
return articleStatus;
}
public void setArticleStatus(String articleStatus) {
this.articleStatus = articleStatus;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
}
Your Company.java
,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Company {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("franco_amount_product")
@Expose
private String francoAmountProduct;
@SerializedName("mail_product")
@Expose
private String mailProduct;
@SerializedName("status")
@Expose
private String status;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFrancoAmountProduct() {
return francoAmountProduct;
}
public void setFrancoAmountProduct(String francoAmountProduct) {
this.francoAmountProduct = francoAmountProduct;
}
public String getMailProduct() {
return mailProduct;
}
public void setMailProduct(String mailProduct) {
this.mailProduct = mailProduct;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
}
Create ResponseModel.java
like,
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
}
Then get your Company object as below,
Gson gson = new Gson();
ResponseModel responseModel = gson.fromJson(jsonStr,ResponseModel.class);
for (int i=0;i<responseModel.getData().size();i++){
Company company = responseModel.getData().get(i).getCompany();
}
what is get(0) all about?
– mishti
Nov 15 '18 at 8:56
there will be for loop on your "data" jsonArray, I have edited my code.
– Shreya Prajapati
Nov 15 '18 at 9:01
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
It is your API response string
– Shreya Prajapati
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 1 more comment
your Datum.java
should be like,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Datum {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("company_id")
@Expose
private String companyId;
@SerializedName("name_nl")
@Expose
private String nameNl;
@SerializedName("description")
@Expose
private String description;
@SerializedName("name_fr")
@Expose
private String nameFr;
@SerializedName("ean_code")
@Expose
private String eanCode;
@SerializedName("mbh")
@Expose
private String mbh;
@SerializedName("msrp")
@Expose
private String msrp;
@SerializedName("article_code")
@Expose
private String articleCode;
@SerializedName("article_status")
@Expose
private String articleStatus;
@SerializedName("source")
@Expose
private String source;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
@SerializedName("company")
@Expose
private Company company;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getNameNl() {
return nameNl;
}
public void setNameNl(String nameNl) {
this.nameNl = nameNl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getNameFr() {
return nameFr;
}
public void setNameFr(String nameFr) {
this.nameFr = nameFr;
}
public String getEanCode() {
return eanCode;
}
public void setEanCode(String eanCode) {
this.eanCode = eanCode;
}
public String getMbh() {
return mbh;
}
public void setMbh(String mbh) {
this.mbh = mbh;
}
public String getMsrp() {
return msrp;
}
public void setMsrp(String msrp) {
this.msrp = msrp;
}
public String getArticleCode() {
return articleCode;
}
public void setArticleCode(String articleCode) {
this.articleCode = articleCode;
}
public String getArticleStatus() {
return articleStatus;
}
public void setArticleStatus(String articleStatus) {
this.articleStatus = articleStatus;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
}
Your Company.java
,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Company {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("franco_amount_product")
@Expose
private String francoAmountProduct;
@SerializedName("mail_product")
@Expose
private String mailProduct;
@SerializedName("status")
@Expose
private String status;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFrancoAmountProduct() {
return francoAmountProduct;
}
public void setFrancoAmountProduct(String francoAmountProduct) {
this.francoAmountProduct = francoAmountProduct;
}
public String getMailProduct() {
return mailProduct;
}
public void setMailProduct(String mailProduct) {
this.mailProduct = mailProduct;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
}
Create ResponseModel.java
like,
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
}
Then get your Company object as below,
Gson gson = new Gson();
ResponseModel responseModel = gson.fromJson(jsonStr,ResponseModel.class);
for (int i=0;i<responseModel.getData().size();i++){
Company company = responseModel.getData().get(i).getCompany();
}
your Datum.java
should be like,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Datum {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("company_id")
@Expose
private String companyId;
@SerializedName("name_nl")
@Expose
private String nameNl;
@SerializedName("description")
@Expose
private String description;
@SerializedName("name_fr")
@Expose
private String nameFr;
@SerializedName("ean_code")
@Expose
private String eanCode;
@SerializedName("mbh")
@Expose
private String mbh;
@SerializedName("msrp")
@Expose
private String msrp;
@SerializedName("article_code")
@Expose
private String articleCode;
@SerializedName("article_status")
@Expose
private String articleStatus;
@SerializedName("source")
@Expose
private String source;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
@SerializedName("company")
@Expose
private Company company;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getNameNl() {
return nameNl;
}
public void setNameNl(String nameNl) {
this.nameNl = nameNl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getNameFr() {
return nameFr;
}
public void setNameFr(String nameFr) {
this.nameFr = nameFr;
}
public String getEanCode() {
return eanCode;
}
public void setEanCode(String eanCode) {
this.eanCode = eanCode;
}
public String getMbh() {
return mbh;
}
public void setMbh(String mbh) {
this.mbh = mbh;
}
public String getMsrp() {
return msrp;
}
public void setMsrp(String msrp) {
this.msrp = msrp;
}
public String getArticleCode() {
return articleCode;
}
public void setArticleCode(String articleCode) {
this.articleCode = articleCode;
}
public String getArticleStatus() {
return articleStatus;
}
public void setArticleStatus(String articleStatus) {
this.articleStatus = articleStatus;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
}
Your Company.java
,
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Company {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("franco_amount_product")
@Expose
private String francoAmountProduct;
@SerializedName("mail_product")
@Expose
private String mailProduct;
@SerializedName("status")
@Expose
private String status;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFrancoAmountProduct() {
return francoAmountProduct;
}
public void setFrancoAmountProduct(String francoAmountProduct) {
this.francoAmountProduct = francoAmountProduct;
}
public String getMailProduct() {
return mailProduct;
}
public void setMailProduct(String mailProduct) {
this.mailProduct = mailProduct;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
}
Create ResponseModel.java
like,
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
}
Then get your Company object as below,
Gson gson = new Gson();
ResponseModel responseModel = gson.fromJson(jsonStr,ResponseModel.class);
for (int i=0;i<responseModel.getData().size();i++){
Company company = responseModel.getData().get(i).getCompany();
}
edited Nov 15 '18 at 9:04
answered Nov 15 '18 at 8:46
Shreya PrajapatiShreya Prajapati
8411
8411
what is get(0) all about?
– mishti
Nov 15 '18 at 8:56
there will be for loop on your "data" jsonArray, I have edited my code.
– Shreya Prajapati
Nov 15 '18 at 9:01
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
It is your API response string
– Shreya Prajapati
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 1 more comment
what is get(0) all about?
– mishti
Nov 15 '18 at 8:56
there will be for loop on your "data" jsonArray, I have edited my code.
– Shreya Prajapati
Nov 15 '18 at 9:01
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
It is your API response string
– Shreya Prajapati
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
what is get(0) all about?
– mishti
Nov 15 '18 at 8:56
what is get(0) all about?
– mishti
Nov 15 '18 at 8:56
there will be for loop on your "data" jsonArray, I have edited my code.
– Shreya Prajapati
Nov 15 '18 at 9:01
there will be for loop on your "data" jsonArray, I have edited my code.
– Shreya Prajapati
Nov 15 '18 at 9:01
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
It is your API response string
– Shreya Prajapati
Nov 15 '18 at 9:21
It is your API response string
– Shreya Prajapati
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 1 more comment
You should create a model class for the response which handles the whole json string:
ResponseModel.java
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
public static ResponseModel fromJson(String json) {
return new Gson().fromJson(json, ResponseModel.class);
}
}
Now you can use it like following to parse the json string:
ResponseModel model = ResponseModel.fromJson(jsonString);
// for example for item 0:
String francoAmountProduct = model.getData().get(0).getCompany().getFrancoAmountProduct();
In a for loop like question content:
for(Datum datum : model.getData()){
Log.e("TAG", "onResponse: " + datum.getCompany().getFrancoAmountProduct());
}
get(0) --- what is 0 all about?
– mishti
Nov 15 '18 at 8:56
Your response contains a list ofDatum
objects. I get the 0-th element for example to show how to achieve thefrancoAmountProduct
.
– aminography
Nov 15 '18 at 9:04
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
jsonString
is response of your webservice call, exactly first block string in your question which you titled it: Data Example
– aminography
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 4 more comments
You should create a model class for the response which handles the whole json string:
ResponseModel.java
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
public static ResponseModel fromJson(String json) {
return new Gson().fromJson(json, ResponseModel.class);
}
}
Now you can use it like following to parse the json string:
ResponseModel model = ResponseModel.fromJson(jsonString);
// for example for item 0:
String francoAmountProduct = model.getData().get(0).getCompany().getFrancoAmountProduct();
In a for loop like question content:
for(Datum datum : model.getData()){
Log.e("TAG", "onResponse: " + datum.getCompany().getFrancoAmountProduct());
}
get(0) --- what is 0 all about?
– mishti
Nov 15 '18 at 8:56
Your response contains a list ofDatum
objects. I get the 0-th element for example to show how to achieve thefrancoAmountProduct
.
– aminography
Nov 15 '18 at 9:04
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
jsonString
is response of your webservice call, exactly first block string in your question which you titled it: Data Example
– aminography
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 4 more comments
You should create a model class for the response which handles the whole json string:
ResponseModel.java
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
public static ResponseModel fromJson(String json) {
return new Gson().fromJson(json, ResponseModel.class);
}
}
Now you can use it like following to parse the json string:
ResponseModel model = ResponseModel.fromJson(jsonString);
// for example for item 0:
String francoAmountProduct = model.getData().get(0).getCompany().getFrancoAmountProduct();
In a for loop like question content:
for(Datum datum : model.getData()){
Log.e("TAG", "onResponse: " + datum.getCompany().getFrancoAmountProduct());
}
You should create a model class for the response which handles the whole json string:
ResponseModel.java
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseModel {
@SerializedName("data")
private List<Datum> data = null;
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
public static ResponseModel fromJson(String json) {
return new Gson().fromJson(json, ResponseModel.class);
}
}
Now you can use it like following to parse the json string:
ResponseModel model = ResponseModel.fromJson(jsonString);
// for example for item 0:
String francoAmountProduct = model.getData().get(0).getCompany().getFrancoAmountProduct();
In a for loop like question content:
for(Datum datum : model.getData()){
Log.e("TAG", "onResponse: " + datum.getCompany().getFrancoAmountProduct());
}
edited Nov 15 '18 at 9:08
answered Nov 15 '18 at 8:21
aminographyaminography
6,29521534
6,29521534
get(0) --- what is 0 all about?
– mishti
Nov 15 '18 at 8:56
Your response contains a list ofDatum
objects. I get the 0-th element for example to show how to achieve thefrancoAmountProduct
.
– aminography
Nov 15 '18 at 9:04
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
jsonString
is response of your webservice call, exactly first block string in your question which you titled it: Data Example
– aminography
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 4 more comments
get(0) --- what is 0 all about?
– mishti
Nov 15 '18 at 8:56
Your response contains a list ofDatum
objects. I get the 0-th element for example to show how to achieve thefrancoAmountProduct
.
– aminography
Nov 15 '18 at 9:04
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
jsonString
is response of your webservice call, exactly first block string in your question which you titled it: Data Example
– aminography
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
get(0) --- what is 0 all about?
– mishti
Nov 15 '18 at 8:56
get(0) --- what is 0 all about?
– mishti
Nov 15 '18 at 8:56
Your response contains a list of
Datum
objects. I get the 0-th element for example to show how to achieve the francoAmountProduct
.– aminography
Nov 15 '18 at 9:04
Your response contains a list of
Datum
objects. I get the 0-th element for example to show how to achieve the francoAmountProduct
.– aminography
Nov 15 '18 at 9:04
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
what is "jsonString" refers to?
– mishti
Nov 15 '18 at 9:18
jsonString
is response of your webservice call, exactly first block string in your question which you titled it: Data Example– aminography
Nov 15 '18 at 9:21
jsonString
is response of your webservice call, exactly first block string in your question which you titled it: Data Example– aminography
Nov 15 '18 at 9:21
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
check my //Edit code as i am not able to get values
– mishti
Nov 15 '18 at 9:31
|
show 4 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314499%2fhow-to-retrieve-jsonobject-inside-jsonarray-using-gson-in-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you generated the Gson model calsses using jsonschema2pojo.org?
– aminography
Nov 15 '18 at 8:24
yes @aminography
– mishti
Nov 15 '18 at 8:35