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. 重构手法之Extrct Method(提炼函数)

    返回总目录 本节包含3个手法: 1.Extract Method(提炼函数) 2.Inline Method(内联函数) 3.Inline Temp(内联临时变量) Extract Method(提炼 ...

  2. SSM 五:Spring核心概念

    第五章:Spring核心概念 一.Spring Ioc 优点: 1.低侵入式设计 2.独立于各种应用服务器 3.依赖注入特性将组建关系透明化,降低耦合度 4.面向切面编程的特性允许将通用性任务集中式处 ...

  3. [转]Oracle 创建 DBLink 的方法

    http://blog.csdn.net/davidhsing/article/details/6408770 1.如果需要创建全局 DBLink,则需要先确定用户有创建 dblink 的权限: 如果 ...

  4. jmockit学习

    下图为jmockit 类图.在我们编写代码时几乎都会用到Expectations(期望)和Verifications(校验),二者均继承自Invacations. 常会用到的注解有:@Mocked @ ...

  5. TensorFlow学习笔记(一):数据操作指南

    扩充 TensorFlow tf.tile 对数据进行扩充操作 import tensorflow as tf temp = tf.tile([1,2,3],[2]) temp2 = tf.tile( ...

  6. Memcached 及 Redis 架构分析和区别比较

    Memcached和Redis作为两种Inmemory的key-value数据库,在设计和思想方面有着很多共通的地方,功能和应用方面在很多场合下(作为分布式缓存服务器使用等) 也很相似,在这里把两者放 ...

  7. c++的引用和c的指针之创建链表,二叉树的烦恼和区别

    /* **代码功能:创建一个令人头疼的不算头疼的链表,然后把特定的数据删除. *这次的主题不是在代码上,主要是关于创建链表时候的传参问题,嘿嘿,不相信你没遇到过 */#include "st ...

  8. Java中net.sf.json包关于JSON与对象互转的问题

    在Web开发过程中离不开数据的交互,这就需要规定交互数据的相关格式,以便数据在客户端与服务器之间进行传递.数据的格式通常有2种:1.xml:2.JSON.通常来说都是使用JSON来传递数据.本文正是介 ...

  9. IK-Analyzer(5.3.1)动态配置自定义词典

    参考文献:http://blog.csdn.net/fatpanda/article/details/37911079 jar包: IK-Analyzer-extra-5.3.1.jar IKAnal ...

  10. Code Kata:超级偶数数列 javascript实现

    超级偶数(SuperEven)是指每一位都是偶数的正整数,例如: 0,2,4,6,8,20,22,24,26,28,40,...,88,200,202,... 要求写一个函数,输入项数n,返回数列第n ...