在SpringMVC应用程序中读取JSON输入-电子邮件问题
我正试图在我的请求参数中传递电子邮件 在我的控制器类中阅读时,我发现以下异常在SpringMVC应用程序中读取JSON输入-电子邮件问题,json,spring,spring-mvc,Json,Spring,Spring Mvc,我正试图在我的请求参数中传递电子邮件 在我的控制器类中阅读时,我发现以下异常 [ Catch Exception : Error Message: Unexpected end-of-input: was expecting closing quote for a string value at [Source: java.io.StringReader@200a200a; line: 1, column: 195] ] http://localhost:8080/appln/fetch
[ Catch Exception : Error Message: Unexpected end-of-input: was expecting closing quote for a string value
at [Source: java.io.StringReader@200a200a; line: 1, column: 195] ]
http://localhost:8080/appln/fetch/
ipdata={"date":"2013-10-05","emailId":"my.email.com@gmail.com"}
如果我的emailId为“myemailcom@gmailcom“.它工作得很好
我的控制器代码看起来有点
ObjectMapper mapper = new ObjectMapper();
mapper.readValue(ipdataString,InputRequestBean.class);
--
我得到的是…{“日期”:“2013-10-05”,“电子邮件ID”:“我的 我的豆子是
public class InputRequestBean {
private String date;
private String emailId;
/**
* @return the date
*/
public String getDate() {
return date;
}
/**
* @param date the date to set
*/
public void setDate(String date) {
this.date = date;
}
/**
* @return the emailId
*/
public String getEmailId() {
return emailId;
}
/**
* @param emailId the emailId to set
*/
public void setEmailId(String emailId) {
this.emailId = emailId;
}
}
做了一些谷歌搜索…这是有效的修复 @RequestMapping(value=“/appln/fetch/{ipdata:.+}”,method=RequestMethod.GET) 春季医生…:
请发布您的
InputRequestBean
类和您得到的实际JSON字符串。我得到的是…{“日期”:“2013-10-05”,“emailId”:我和我的bean是你可以编辑你的问题,你知道吗?谢谢。添加了问题本身。如果你从服务中收到的JSON与你在ipdata
中显示的一样,那么这应该可以正常工作。