How To Parse Nested Json Using Gson
I am currently making a get request using volley and in onResponse i am trying to parse the jsonObject using gson to my model. JSON Returned after the request is made: { 'succ
Solution 1:
There is a little mistake in your code.So you should change ClientData clientData to ClientData data. Then you can get the data.Hope this will help you in parsing.
Solution 2:
i have a really easy approach for you:
first of all create the main model: and the other one for "data"
publicclassFeedBackModel{
int success;
String message;
DataModel data;
}
publicclassDataModel{
String company;
String email;
//etc ...
}
// create getter& setter for variables
then when you got json, parse it like this:
Gsongson=newGson();
TypeCollectionType=newTypeToken<FeedBackModel>() {
}.getType();
FeedBackModelFeedBack= gson.fromJson(json, CollectionType);
Post a Comment for "How To Parse Nested Json Using Gson"