未捕获的语法错误:位于1的JSON中的意外令牌I [英] Uncaught syntaxerror: unexpected token I in JSON at position 1
本文介绍了未捕获的语法错误:位于1的JSON中的意外令牌I的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到以下错误:
i got below error :
VM230:1 Uncaught SyntaxError: Unexpected token i in JSON at position 1
at JSON.parse (<anonymous>)
at eval (eval at <anonymous> (interactionEvents.html:4), <anonymous>:1:6)
at interactionEvents.html:29
(anonymous) @ VM229:1
(anonymous) @ interactionEvents.html:29
我是什么尝试过:
var a ={id:1,标签:'节点1',标题:'我有一个弹出窗口!'} ;
JSON.parse(a)
What I have tried:
var a = "{id: 1, label: 'Node 1', title: 'I have a popup!'}";
JSON.parse(a)
推荐答案
{id: 1, label: 'Node 1', title: 'I have a popup!'}
是一个无效的 JSON
字符串。它应该是
Is an invalid JSON
string. It should be
{"id": 1, "label": "Node 1", "title": "I have a popup!"}
例如,测试它: JSONLint - JSON验证器 [ ^ ]。
您还可以使用在线验证器检查任何JSON表达式。
例如 JSON Formatter&验证器 [ ^ ]
你应该使用双引号。
You should use double quotes.
{
"id":1,
"label":"Node 1",
"title":"I have a popup!"
}
这篇关于未捕获的语法错误:位于1的JSON中的意外令牌I的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文