JSON.parse解析报错解决方法

res = JSON.parse(result.replace(/\n/g,"\\n").replace(/\r/g,"\\r"));//转义
str_o = res.result;
str_n = str_o.replace(/\\n/g,"\r\n");//解析后再转回来

 

摘自:https://blog.csdn.net/qq_31934975/article/details/78364301

 

posted @ 2019-10-22 14:26  浪浪浪浪浪浪浪浪  阅读(2528)  评论(0编辑  收藏  举报