1
當我從數據庫中檢索列表時,我得到「預期的BEGIN_ARRAY,但是在第1行第1列路徑$」STRING。如何解決這個問題,我錯誤地在我的代碼..事先感謝。
我越來越JSON響應低於,
[{
"eventId":1,
"ringeeUserId":2,
"text":"Reception1",
"place":"Erode",
"eventDate":"2015-10-03",
"startTime":"09:00 AM",
"endTime":"12:00 PM",
"isActive":0,
"isDelete":0,
"eventUserRelationBOs":[]
}]
EventBO類文件下面,
package com.ringeeapp.service.businessobjects;
import java.io.Serializable;
import java.util.List;
public class EventBO implements Serializable {
private static final long serialVersionUID = 281625146097131515L;
private long eventId;
private long ringeeUserId;
private String text;
private String place;
private String eventDate;
private String startTime;
private String endTime;
private int isActive;
private int isDelete;
private List<EventUserRelationBO> eventUserRelationBOs;
public long getEventId() {
return eventId;
}
public void setEventId(long eventId) {
this.eventId = eventId;
}
public long getRingeeUserId() {
return ringeeUserId;
}
public void setRingeeUserId(long ringeeUserId) {
this.ringeeUserId = ringeeUserId;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
public String getEventDate() {
return eventDate;
}
public void setEventDate(String eventDate) {
this.eventDate = eventDate;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public int getIsDelete() {
return isDelete;
}
public void setIsDelete(int isDelete) {
this.isDelete = isDelete;
}
public int getIsActive() {
return isActive;
}
public void setIsActive(int isActive) {
this.isActive = isActive;
}
public List<EventUserRelationBO> getEventUserRelationBOs() {
return eventUserRelationBOs;
}
public void setEventUserRelationBOs(List<EventUserRelationBO> eventUserRelationBOs) {
this.eventUserRelationBOs = eventUserRelationBOs;
}
}
下面的代碼,過程JSON數據
public @ResponseBody String getAllInvites(@RequestParam("userBO") String userBo) {
List<EventBO> eventBOs = new ArrayList<EventBO>();
UserBO userBO = gson.fromJson(userBo, UserBO.class);
try {
eventBOs = manageEventServiceImpl.getAllInvites(userBO);
log.info("getting all events for user " + userBO.getRingeeUserId());
} catch (UserServiceException serExp) {
log.error("Error while getting event for userId id" + userBO.getRingeeUserId(), serExp);
}
return gson.toJson(eventBOs);
}
我猜你在這裏發佈的JSON不完全是你試圖解析的JSON - 你確定你做了一個確切的副本? – Nitek
是的,它是一個確切的副本 –
請顯示您用於處理JSON數據的代碼。 – Wormbo