不确定我是使用正确的语法还是正确声明我的类,但它似乎没有在JSONArray中解析JSONArray。
我做错了什么?
这是我的JSON文件:
{
"response": {
"status": 200
},
"items": [
{
"item": [
{
"body": "Computing",
"subject": "Math",
"attachment": false
}
]
},
{
"item": {
"body": "Analytics",
"subject": "Quant",
"attachment": true
}
}
],
"score": 10,
"uri": "http://localhost/v2.0.0/surveys/5511fa0b7ccabf820b08172a/5512d3de7ccabf820b081731/",
"thesis": {
"submitted": false,
"title": "Masters",
"field": "Sciences"
}
}
以下是我正在使用的课程:
public class Thing
{
public Response response;
public ArrayList<ItemWrapper> items;
public int score;
public URI uri;
public Thesis thesis;
public URI getUri() {
return uri;
}
public void setUri(URI uri) {
this.uri = uri;
}
public Response getResponse() {
return response;
}
public void setResponse(Response response) {
this.response = response;
}
public ArrayList<ItemWrapper> getItems() {
return items;
}
public void setItems(ArrayList<ItemWrapper> items) {
this.items = items;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public Thesis getThesis() {
return thesis;
}
public void setThesis(Thesis thesis) {
this.thesis = thesis;
}
}
class Response
{
public int status;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
class ItemWrapper
{
public ArrayList<Item> item;
public ArrayList<Item> getItem() {
return item;
}
public void setItem(ArrayList<Item> item) {
this.item = item;
}
}
class Item
{
public String body;
public String subject;
public boolean attachment;
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public boolean isAttachment() {
return attachment;
}
public void setAttachment(boolean attachment) {
this.attachment = attachment;
}
}
class Thesis
{
public boolean submitted;
public String title;
public String field;
public boolean isSubmitted() {
return submitted;
}
public void setSubmitted(boolean submitted) {
this.submitted = submitted;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
}