JSON.parse:预期的属性名称或“}" [英] JSON.parse: expected property name or '}'
本文介绍了JSON.parse:预期的属性名称或“}"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
数据包含(/"
/):
{"test":"101","mr":"103","bishop":"102"}
脚本:
console.log($.parseJSON(result));
我遇到错误
JSON.parse: expected property name or '}'.
推荐答案
在JSON文件中使用单引号时,出现相同的问题,所有字符串属性/值都改为双引号,现在可以正常工作,希望对任何人有帮助. ..
Had same issue when used single quotes in JSON file, changed to double quotes for all string properties/values and it's working OK now, hope it helps anyone....
更改:
JSON.parse("{'wrongQuotes': 5}")
收件人:
JSON.parse('{"rightQuotes": 5}')
这篇关于JSON.parse:预期的属性名称或“}"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文