JSON parse error: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\\\\r, \\\\n,

本文分析了一个关于设备异常查询接口的内部服务器错误,错误发生在POST请求过程中,详细记录了HTTP状态码、错误类型及可能的原因,并提供了解决方案,通过调整方法类型从PostMapping到GetMapping并更改参数接收方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误:

{
    "timestamp": "2022-11-01T10:34:27.891+0000",
    "status": 500,
    "error": "Internal Server Error",
    "message": "[400] during [POST] to [http://iwater-d-s/device/exception/getDeviceExceptionsByAreaIdPage] [DeviceExceptionFeign#getDeviceExceptionsByAreaIdPage(Map)]: [{\"timestamp\":\"2022-11-01T10:34:27.888+0000\",\"status\":400,\"error\":\"Bad Request\",\"message\":\"JSON parse error: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\\\\r, \\\\n, \\\\t) is allowe... (511 bytes)]",
    "path": "/data/area/findAreaExceptionList"
}

原因:

params = {LinkedHashMap@15894}  size = 5
 "limit" -> "500"
 "page" -> "1"
 "exception" -> "0"
 "areaIdByUserId" -> {ArrayList@18916}  size = 109
 "companyId" -> {Long@19258} 12
@PostMapping("/exception/getDeviceExceptionsByAreaIdPage")
PageResult<AreaDeviceExceptionCountDTO> getDeviceExceptionsByAreaIdPage(@RequestBody Map<String, Object> params);

@ApiOperation(value = "分页查询小区异常列表")
@PostMapping("/exception/getDeviceExceptionsByAreaIdPage")
public PageResult getDeviceExceptionsByAreaIdPage(@RequestBody Map<String,Object> params) {
	//List<Long> areaIdList = JsonUtil.toList(areaIds);
	return deviceExceptionService.getDeviceExceptionsByAreaIdPage(params);
}

解决:

@GetMapping("/exception/getDeviceExceptionsByAreaIdPage")
PageResult<AreaDeviceExceptionCountDTO> getDeviceExceptionsByAreaIdPage(@RequestBody Map<String, Object> params);

@ApiOperation(value = "分页查询小区异常列表")
@GetMapping("/exception/getDeviceExceptionsByAreaIdPage")
public PageResult getDeviceExceptionsByAreaIdPage(@RequestParam Map<String,Object> params) {
	//List<Long> areaIdList = JsonUtil.toList(areaIds);
	return deviceExceptionService.getDeviceExceptionsByAreaIdPage(params);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值