我正在尝试在Spring 3中将JSON对象发布到控制器.
我收到以下错误:
2010-10-20 17:59:14,391 DEBUG [org.springframework.web.servlet.DispatcherServlet] Could not complete request
org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized token 'tilI': was expecting 'null', 'true' or 'false'
at [Source: org.apache.catalina.connector.CoyoteInputStream@1509a99; line: 1, column: 9]; nested exception is org.codehaus.jackson.JsonParseException: Unrecognized token 'tilI': was expecting 'null', 'true' or 'false'
at [Source: org.apache.catalina.connector.CoyoteInputStream@1509a99; line: 1, column: 9]
at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readInternal(MappingJacksonHttpMessageConverter.java:138)
at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:154)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.readWithMessageConverters(HandlerMethodInvoker.java:643)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestBody(HandlerMethodInvoker.java:607)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:346)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:427)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:415)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) …Run Code Online (Sandbox Code Playgroud) 我正在向URL发送此ajax请求,但服务器正在发送响应Unrecognized token 'naejzraieale': was expecting 'null', 'true', 'false' or NaN
at [Source: org.eclipse.jetty.server.HttpInput@13367e3; line: 1, column: 25].
我的Ajax请求看起来像这样
$.ajax({url: "https://jsonparser.mydomain.com",
contentType: 'application/json',
type: "POST",
data :{name : "juzer ali",
email : "email@gmail.com",
how : "Used jQuery.ajax from google chromes developer console",
urls : ["https://chrome.google.com/webstore/search/", "https://chrome.google.com/webstore/detail/",
"https://github.com", "https://docs.google.com/document/d/edit?pli=1", "pro.appspot.com"]}
});
Run Code Online (Sandbox Code Playgroud)
编辑:请注意Unrecognized token 'naejzraieale':.在j与r此错误字符串是从我传递数据对象的name属性.当我把这些字母大写时,我明白了(Unrecognized token 'naeJZRAIeale': was expecting 'null', 'true',)