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')的更多相关文章

  1. 关于 redis 报错 :JsonParseException: Unrecognized token 'xxx': was expecting ('true', 'false' or 'null')

    在使用java  读取redis存储的数据时出现 JsonParseException: Unrecognized token 'xiaoqiang': was expecting ('true', ...

  2. com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'user'

    nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'user' 可能错误原因: ...

  3. Unrecognized token 'XXXX': was expecting ('true', 'false' or 'null')

    原因是,返回或发送数据格式不规范. 当dataType指定为json后,1.4+以上的jquery版本对json格式要求更加严格.如果不是严格的json格式,就不能正常执行success回调函数. J ...

  4. python中发送post请求时,报错“Unrecognized token 'xxxx': was expecting ('true', 'false' or 'null')”

    解决办法: 如请求参数为 data={“user”=“aaa”,“pwd”=“123456”,sign=“00000000000000”} 需要将参数data先做处理,调用函数datas=datajs ...

  5. com.fasterxml.jackson.core.JsonParseException: Unexpected character

    com.fasterxml.jackson.core.JsonParseException: Unexpected )): was expecting double-quote to start fi ...

  6. springmvc java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z

    在hibernate spring springMVC整合的时候出现下面的情况: WARNING: Exception encountered during context initializatio ...

  7. java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException

    我从0手动搭建框架,启动tomcat,遇到这个错:java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingEx ...

  8. Springmvc4 com/fasterxml/jackson/core/JsonProcessingException

    非常感谢: 谭卓博客 springmvc4 json springmvc4 集成hibernate4 出现 NoClassDefFoundError:com/fasterxml/jackson/cor ...

  9. 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 ...

随机推荐

  1. bzoj1003

    考虑dp[i]表示前i天的最小总成本. 枚举上一次在第j天之后对路线进行了修改,那么就由dp[j]转移至dp[i],转移的代价是把第[j+1,i]天所有被占用的点全删掉后的最短路(不连通当然就是INF ...

  2. asp.net web api客户端调用

    服务接口 接口1: //Post:http://127.0.0.1/HY_WebApi/api/V2/Key/FunctionTest1 [HttpPost] public HttpResponseM ...

  3. OpenCV探索之路(二十七):皮肤检测技术

    好久没写博客了,因为最近都忙着赶项目和打比赛==| 好吧,今天我打算写一篇关于使用opencv做皮肤检测的技术总结.那首先列一些现在主流的皮肤检测的方法都有哪些: RGB color space Yc ...

  4. Hi3518EV200平台ADC多通道采样

    Hi3518EV200平台ADC多通道采样流程 Hi3518EV200 ADC 本文针对Hi3518EV200平台处理器,通过ADC单次采样方式,实现对多通道(1~4通道)ADC进行采样控制.本文仅仅 ...

  5. spring学习笔记(一) Spring概述

    博主Spring学习笔记整理大部分内容来自Spring实战(第四版)这本书.  强烈建议新手购入或者需要电子书的留言. 在学习Spring之前,我们要了解这么几个问题:什么是Spring?Spring ...

  6. listview相关代码整理

    虽然listview已经慢慢被替代了,  不过还是整理下 , 留作纪念吧 /** * 获取 listview 实际滚动的距离. [ 相对于listview的第一个项目左上角.] * * @return ...

  7. 从.git文件夹探析git实现原理

    git是一款分布式代码版本管理工具,通过git能够更加高效地协同编程.了解git的工作原理将有助于我们使用git工具更好地管理项目.通过了解.git文件夹中的文件组成,我们可以从一个角度去窥探git的 ...

  8. 最耗性能的SQL语句

    设计优化–常见杀手级SQL •SELECT * vsSELECT col1, col2 •ORDER BY RAND() •LIMIT huge_num, offset •SELECT COUNT(* ...

  9. 安装apache

    1.安装依赖软件 pcre gcc expat apr(Apache portable Run-time libraries,Apache可移植运行库) apr-util [root@localhos ...

  10. c#游戏进程杀手

    我认为写博客还是比较重要的,特别是短时间写出一个含有新知识点的软件.这样总结下这次编程经验和再捋顺一下这次编程思路.首先来谈谈为什么想做这个小程序,一是感觉自己太贪玩想控制一下,二是也锻炼下自己的编程 ...