Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'name': was expecting ('true', 'false' or 'null')
Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'name': was expecting ('true', 'false' or 'null')
参数有问题,不能解析成json对象
ajax提交添加下面两行代码
contentType:'application/json;charset=utf-8'
data:JSON.stringify(数据)
var allData = {
name:"张三",
age:20
};
$.ajax({
type: "POST",
url: "xxxx",
contentType:'application/json;charset=utf-8',
data:JSON.stringify(allData),
success: function (data) {
alert(data);
}
});
注意:
后端如果用springMVC的@RequestBody注解的话,则只能Json对象的字符串,不能接收Json对象,用 JSON.stringify(data)的方式将对象变成字符串,同时ajax请求也要指定dataType: "json",contentType:"application/json" ,这样就能用@RequestBody注解绑定对象或者List集合.
Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'name': was expecting ('true', 'false' or 'null')的更多相关文章
- 关于 redis 报错 :JsonParseException: Unrecognized token 'xxx': was expecting ('true', 'false' or 'null')
在使用java 读取redis存储的数据时出现 JsonParseException: Unrecognized token 'xiaoqiang': was expecting ('true', ...
- com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'user'
nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'user' 可能错误原因: ...
- Unrecognized token 'XXXX': was expecting ('true', 'false' or 'null')
原因是,返回或发送数据格式不规范. 当dataType指定为json后,1.4+以上的jquery版本对json格式要求更加严格.如果不是严格的json格式,就不能正常执行success回调函数. J ...
- python中发送post请求时,报错“Unrecognized token 'xxxx': was expecting ('true', 'false' or 'null')”
解决办法: 如请求参数为 data={“user”=“aaa”,“pwd”=“123456”,sign=“00000000000000”} 需要将参数data先做处理,调用函数datas=datajs ...
- com.fasterxml.jackson.core.JsonParseException: Unexpected character
com.fasterxml.jackson.core.JsonParseException: Unexpected )): was expecting double-quote to start fi ...
- springmvc java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
在hibernate spring springMVC整合的时候出现下面的情况: WARNING: Exception encountered during context initializatio ...
- java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException
我从0手动搭建框架,启动tomcat,遇到这个错:java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingEx ...
- Springmvc4 com/fasterxml/jackson/core/JsonProcessingException
非常感谢: 谭卓博客 springmvc4 json springmvc4 集成hibernate4 出现 NoClassDefFoundError:com/fasterxml/jackson/cor ...
- Java——使用ObjectMapper.writeValueAsString时报错The type com.fasterxml.jackson.core.JsonProcessingException cannot be resolved. It is indirectly referenced from required .class files
报错信息: The type com.fasterxml.jackson.core.JsonProcessingException cannot be resolved. It is indirect ...
随机推荐
- Python之hashlib模块
hashlib 在做一个授权管理系统,需要生产动态生成密码,故使用hashlib >>> import time >>> import hashlib >&g ...
- 用MVC导入导出
导入导出对于刚做的人一脸懵逼,但是明白思路之后就感觉非常容易,我也是研究了好久,才总算做了出来,放在这里给大家分享一下 一.先看下导出 视图脚本 <script type ="text ...
- Java面试之框架篇(八)
71,谈谈你对Struts的理解. 1. struts是一个按MVC模式设计的Web层框架,其实它就是一个Servlet,这个Servlet名为ActionServlet,或是ActionServle ...
- C语言中静态申请内存遇到的错误分析
今天调试代码中,遇到了一个比较奇怪的打印,dump出来的数据只有前四位有值,其他后面的都为零. 出于直觉,应该是内存没有申请到.仔细核对代码之后,果真发现了一个语法错误,就是使用指针的指针时 ,对申请 ...
- udp和tcp
tcp(Transmission Control Protocol 传输控制协议) 协议复杂,有序和可靠.编号和分段实现了有序,ACK(acknowledge)和重新发送实现了可靠. 滑窗实现了同时发 ...
- python3.5安装pyHook,解决【TypeError: MouseSwitch() missing 8 required positional arguments: 'msg', 'x', 'y', 'data', 'time', 'hwnd', and 'window_name'】这个错误!
为什么安装 pyHook包:为Windows中的全局鼠标和键盘事件提供回调. Python应用程序为用户输入事件注册事件处理程序,例如鼠标左键,鼠标左键,键盘键等 先要实时获取系统的鼠标位置或者键盘输 ...
- leetcode算法题2: 合并两个二叉树。递归,如何切入并保持清醒?
/* Given two binary trees and imagine that when you put one of them to cover the other, some nodes o ...
- tomcat警告setting property 'debug' to '0' did not find a matching property
在使用tomcat6.0版本结合myeclipse进行java web项目,运行程序显示setting property 'debug' to '0' did not find a matching ...
- 文件夹的创建(cmd利用)
在windows本地上创建文件夹是无法用..结束的,我们要创建的话,需要在cmd里面进行创建输入 mkdir abc..\ 那么我们从本地看出abc..文件夹建成了怎么删除呢? 需要手动在里面建个文件 ...
- appium+Linux环境安装配置
背景:想要在Jenkins上跑appium的自动化测试,所以想要在Jenkins服务器(Linux远程)上安装appium服务,故而研究了一下appium+Linux下安装.虽然有无数的前辈踩过坑 ...