JSON parse错误
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拥有更有用的错误
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错误


