JSON parse错误

qq_18667201 qq_18667201 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
results=$("#articleCommentDiv").attr("context");
data=JSON.parse(results);

results的内容是
{
"requestType":"ajax",
"path":"/爱的色放的说法",
"articleId":699286459,
"targetChannel":"新闻中心",
"targetMenu":啊的说法答复"
}



json那行报错SyntaxError: Unexpected token u
...全文

相关推荐

Node.js-parse-json-解析JSON拥有更有用的错误

parse-json - 解析JSON拥有更有用的错误

weixin_39841365

parse-json:解析JSON有更多有用的错误

解析JSON 解析JSON有更多有用的错误 安装 $ npm install parse-json 用法 const parseJson = require ( 'parse-json' ) ; const json = '{\n\t"foo": true,\n}' ; JSON . parse ( json ) ; /* undefined:3 } ^ SyntaxError: Unexpected token } */ parseJson ( json ) ; /* JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}' 1 | { 2 | "foo": true, > 3 | } | ^ */ parseJson ( json

蓝精神

json-parse-helpfulerror:同步 JSON.parse 的替代品,使用 `jju` 产生有用的错误

json-parse-helpfulerror JSON.parse替代品,它使用在发生解析错误时提供更有用的错误消息。 例子 安装 npm i -S json-parse-helpfulerror 用 var jph = require ( 'json-parse-helpfulerror' ) ; var notJSON = "{'foo': 3}" ; // keys must be double-quoted in JSON JSON . parse ( notJSON ) ; // throws unhelpful error jph . parse ( "{'foo': 3}" ) // throws more helpful error: "Unexpected token '\''..." 执照 麻省理工学院

信念与梦想

Better-Error-message-for-json-parse:如果JSON.parse失败,则应显示错误发生的位置

安全的JSON解析 该项目的主要目标是为解析JSON数据时可能发生的SyntaxError提供一个不错的错误消息。 例如,解析以下JSON: { "index": 1, "index_start_at": 56, "integer": 6, "float": 11.6816, "name": "Eva", "surname" "Rowland", "fullname": "Denise Pickett", "email": "jack@garrison.vc", "bool": false } 将导致以下错误消息: Unexpected string

胡説个球

JSON.parse 解析字符串出错的解决方法

程序中很多数据是动态拼接而成的json数据,最近在用json的时候老是现JSON.parse错误

weixin_38627826
评论 3
收藏 已收藏
分享
返回顶部
qq_18667201
JavaScript 87,983 成员 224,681 内容