spring boot 接受ajax数组
来源:互联网 发布:linux系统漏洞修复 编辑:程序博客网 时间:2024/05/20 19:19
最近在用spring boot + vue.js作后台,在做批量删除的时候出现了异常
jackson报的错
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Can not deserialize instance of java.lang.String[] out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String[] out of START_OBJECT token
at [Source: java.io.PushbackInputStream@72bf7f09; line: 1, column: 1]
转换成fastjson报的错
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: exepct '[', but {, pos 1, json : {"systemIds":["1201678f34e24bf087a33efb88ca1d64 ","0e90bc00e6914c51bd0dfee01c97b55a "]}; nested exception is com.alibaba.fastjson.JSONException: exepct '[', but {, pos 1, json : {"systemIds":["1201678f34e24bf087a33efb88ca1d64 ","0e90bc00e6914c51bd0dfee01c97b55a "]}
好吧,看不懂,果断把spring boot原生的jackjson换成咱们中国的fastjson,好了,这下看懂了。原来是我前台发送的参数不对。json转换需要最外层就是数组的[],我的参数在内层才是数组。
const url = self.HOST + "/system/delete";self.$axios.post(url,{systemIds:ids}).then((response) => { if(response.data.code == '100'){ self.$message.success('批量删除成功'); }else{ self.$message.error(response.data.mesg); }})
把参数换成这样就对了
好吧,看不懂,果断把spring boot原生的jackjson换成咱们中国的fastjson,好了,这下看懂了。原来是我前台发送的参数不对。
const url = self.HOST + "/system/delete";self.$axios.post(url,ids).then((response) => { if(response.data.code == '100'){ self.$message.success('批量删除成功'); }else{ self.$message.error(response.data.mesg); }})
好吧,看不懂,果断把spring boot原生的jackjson换成咱们中国的fastjson,好了,这下看懂了。原来是我前台发送的参数不对。
- spring boot 接受ajax数组
- spring mvc接受list数组
- spring mvc 接受对象数组
- 使用AJAX传数组,后台接受数组
- Spring Boot AJAX 示例
- MVC ACTION接受ajax提交数组
- django 接受 ajax 传来的数组对象
- @RequestBody Spring MVC接受对象数组,并接受其它参数
- ajax传数组到后台,后台springmvc 接受数组参数
- 分页查询spring boot+spring data+ajax
- springMVC 接受前台 jquery ajax 发送的 字符串和 数组
- 常见问题一jQuery中ajax接受json数组
- ajax传数组到后台Springmvc无法接受的问题
- spring boot+前端ajax请求通讯
- Spring Boot Ajax 提交对象类型
- Spring boot Ajax 跨域问题
- spring boot——ajax跨域
- spring boot框架接受http请求并处理的代码公式
- 结构体对齐
- 初识软件测试
- 测试Linux内核驱动程序
- 链路层
- liunx 防火墙操作
- spring boot 接受ajax数组
- unbuntu 37~16.04.1 安装IDEA
- android 修改viewpage滑动速度
- 分享一下赶集网的反扒策略
- 深入理解Thread.sleep的含义
- Unity 动态修改UGUI的Image
- android 中序列化对象
- 【React Native】Android打包发布(九)
- bzoj 3365(点分治)