昨天我管理如何将json转换为列表<>,json文件非常简单。Gson - 转换表单json(List列表内)列表<> Android
现在我其中有一个列表中列出这里是一个儿子文件:
<
这里我的代码:
listq = new ArrayList<Survey>();
try {
result = new RequestTask().execute("urveys/current?owner=ofc&user=yasser&category=-1").get();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
GsonBuilder gsonb = new GsonBuilder();
Gson gson = gsonb.create();
listq = gson.fromJson(result, Surveyentity.class).List;
Toast.makeText(Questions.this, "result", Toast.LENGTH_SHORT).show();
}
我的班级调查:
public class Survey {
String IdQuestion;
String Label;
List<Reponse> Reponses;
public String getIdQuestion() {
return IdQuestion;
}
public void setIdQuestion(String idQuestion) {
IdQuestion = idQuestion;
}
public String getLabel() {
return Label;
}
public void setLabel(String label) {
Label = label;
}
public List<Reponse> getReponses() {
return Reponses;
}
public void setReponses(List<Reponse> reponses) {
Reponses = reponses;
}
我的班级回复:
public class Reponse {
String IdProposition;
String Label;
String Format;
String url;
String Points;
String Next;
String Comment;
String Selected;
public String getIdProposition() {
return IdProposition;
}
public void setIdProposition(String idProposition) {
IdProposition = idProposition;
}
.............
和我的课调查单位:
public class Surveyentity {
public List<Survey> List;
}
如何处理此问题?
'名单反应变量; '应该'列表列表;' –
2015-02-24 11:01:58