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

时间:2021-05-26 03:26:41
【文件属性】:
文件名称:parse-json:解析JSON有更多有用的错误
文件大小:6KB
文件格式:ZIP
更新时间:2021-05-26 03:26:41
JavaScript 解析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
【文件预览】:
parse-json-main
----.gitignore(44B)
----package.json(825B)
----.npmrc(19B)
----index.js(1KB)
----test.js(848B)
----.github()
--------security.md(179B)
--------workflows()
--------funding.yml(116B)
----license(1KB)
----readme.md(2KB)
----.gitattributes(19B)
----.editorconfig(175B)

网友评论