您的位置:首页 > Web前端 > JavaScript

使用fastjson时报not match : - =错误

2016-10-19 00:00 489 查看
后台解析前台传过来的map时,将字符串转为list时报错,后来在后台打印数据发现是前台传过来的数据格式不正确。

前台开始是这么传值的:

var map = {
'auditStatus': type,
'reportSheetIdList': reportSheetIdList
}

这时候,后台接收到的reportSheetIdList是这样的:[{"reportSheetId":297eb12757da695b0157da6ab00e0000}],

这时候List<ReportSheet> reportSheetIdList = JSON.parseArray(reportSheetIdListStr, ReportSheet.class);肯定报错了。

所以前台需要将reportSheetIdList提前转为json格式的。

如下:

var map = {
'auditStatus': type,
'reportSheetIdList': JSON.stringify(reportSheetIdList)
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息