JSONObject.parseObject syntax error,expect START WITH { OR [,but actually START WITH error
JSONObject.parseObject syntax error,expect START WITH { OR [,but actually START WITH error
解析JSON出现异常(JSON返回结果)
请求的url格式错误:
正确的:https://服务的IP:端口 /接口名称 ?参数列表
错误的:https://服务的IP:端口 ?参数列表
排查方法:可以将接口请求的返回结果打印出来,如果不是json的字符串,在做转换的时候,会报该错误。
ResponseData responseData = JSONObject.parseObject(responseStr,ResponseData.class);
public class ResponseData<T> {
private static final long serialVersionUID = 6898451165550538312L;
@AutoDocProperty("返回代码")
private String resCode;
@AutoDocProperty("返回消息")
private String resMsg;
@AutoDocProperty("返回实体")
private T data;
}
//如果对接收到的json串转换为对象,需要将接收类具体化,而不是T泛型的方式。
ResponseGps responseData = JSON.parseObject(responseStr, ResponseGps.class);
public class ResponseGps {
private String resCode;
private String resMsg;
private GpsVo data;
}
JSONObject.parseObject syntax error,expect START WITH { OR [,but actually START WITH error的更多相关文章
- redis通过json方案存取对象com.alibaba.fastjson.JSONException: syntax error, expect
问题描述: redis基于json方案存取对象时报错:com.alibaba.fastjson.JSONException: syntax error, expect com.alibaba.fast ...
- mysql报错sql injection violation, syntax error: syntax error, expect RPAREN, actual IDENTIFIER
mysql报错sql injection violation, syntax error: syntax error, expect RPAREN, actual IDENTIFIER 处理,在控制台 ...
- Hibernate 执行sql语句返回yntax error: syntax error, expect LPAREN, actual NOT not
hibernate自动创建表时提示 : ERROR: sql injection violation, syntax error: syntax error, expect LPAREN, actu ...
- Caused by: com.alibaba.fastjson.JSONException: syntax error, expect {, actual [, pos 0, fastjson-version 1.2
环境: vue.js 问题: 当添加评论时 重新查询数据刷新数据控制台异常Caused by: com.alibaba.fastjson.JSONException: syntax error, ex ...
- JSONObject.parseObject
{ "data":{ "shop_uid":"123"; “id”:"123" } } 将上面的json字符串转换为JS ...
- JSON.parseObject(String str)与JSONObject.parseObject(String str)的区别
一.首先来说说fastjson fastjson 是一个性能很好的 Java 语言实现的 JSON 解析器和生成器,来自阿里巴巴的工程师开发.其主要特点是: ① 快速:fastjson采用独创的算法, ...
- JSONObject.parseObject(jsonStr);和JSONObject.fromObject(jsonStr);
虽然都是返回JSONObject,但是 JSONObject.parseObject(jsonStr);这个方法需要导入import com.alibaba.fastjson.JSONObject; ...
- net.sf.json.JSONOBJECT.fromObject 与 com.alibaba.fastjson.JSONObject.parseObject
文章待补充,先写写以下知识点好了. NULL值处理之 net.sf.json.JSONObject 和 com.alibaba.fastjson.JSONObject区别 JSON作为一个轻量级的文本 ...
- 两个对象值转换的方法(BeanUtils.copyProperties与JSONObject.parseObject对比)
将源对象赋值到目标对象方法: 方法一:BeanUtils.copyProperties(源对象, 目标对象); //org.springframework.beans.BeanUtils 方法二:目标 ...
- error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status
Windows服务器Azure云编译安装MariaDB教程 www.111cn.net 编辑:future 来源:转载 安装MariaDB数据库最多用于linux系统中了,下文给各位介绍在Window ...
随机推荐
- 跳板攻击之:NPS代理转发
跳板攻击之:NPS代理转发 目录 跳板攻击之:NPS代理转发 1 NPS介绍 2 NPS特点 3 实验环境 3.1 实验准备 3.2 实验拓扑 3.3 NPS配置 3.3.1 conf/nps.con ...
- 按highcharts中column形式转对象展现格式
highcharts图表type:column事例的格式是这样的: (不论接口返回什么格式,需要转换成下面这样的): xAxis: { categories: ['一月','二月'], }, seri ...
- LeetCode-2043 两数相加题解
来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/simple-bank-system 题目描述 你的任务是为一个很受欢迎的银行设计一款程序,以自动 ...
- 工业仿真:Chai 3D之点云技术
推荐:将 NSDT场景编辑器 加入你的3D开发工具链. 介绍 点云是三维坐标系中的一组数据点.在 CHAI3D 中,这些点由 X.Y 和 Z 坐标定义,通常用于表示对象的外表面. 点云可以由3 ...
- c++_成员函数回调
//--------------------------------------------------------------------------- #include <vcl.h> ...
- EF Core迁移 (provider: SSL Provider, error: 0 - 证书链是由不受信任的颁发机构颁发的。)
A connection was successfully established with the server, but then an error occurred during the log ...
- [转载]python跨文件使用全局变量的实现
python跨文件使用全局变量的实现 更新时间:2022-10-25 14:46:38发布时间:602天前 朗读 Python 定义了全局变量的特性,使用global 关键字修饰 1 global k ...
- nginx反向代理hyperf
location / { #反向代理到 本地9501端口 proxy_pass http://127.0.0.1:9501; proxy_redirect off; p ...
- FTCL:Fine-grained Temporal Contrastive Learning for Weakly-supervised Temporal Action Localization概述
1.针对的问题 现有的方法主要遵循于通过优化视频级分类目标来实现定位的方式,这些方法大多忽略了视频之间丰富的时序对比关系,因此在分类学习和分类-定位自适应的过程中面临着极大的模糊性.(1)在弱监督设置 ...
- 泛微js附件必填
function fieldViewAttr(fieldid, viewtype) { alert('11') jQuery("#field" + fieldid).attr(&q ...