Answer the question
In order to leave comments, you need to log in
Java Gson how to organize different objects?
Hello.
status: "ok"
data: [
{
name: name1,
description: asdfasdfasdf
items:
[
{
name: name
}
]
},
{
name: name1,
description: asdfasdfasdf
items:
[
{
name: name,
desc: 32
age: 123123
}
]
}
}
]
Class1 class1 = new Gson.fromJson(response, Class1.class);
Answer the question
In order to leave comments, you need to log in
public class Class1 {
private String status;
private List<Class2> data;
}
public class Class2 {
private String name;
private String description;
private List<Item> items;
}
public class Item {
private String name;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question