JSON解析错误:预期为"STRING" [英] JSON Parse Error: Expecting 'STRING'
本文介绍了JSON解析错误:预期为"STRING"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 JSONLint 解析一些JSON,但我不断收到错误消息:
I am using JSONLint to parse some JSON and i keep getting the error:
错误:第1行解析错误: [{产品":[{"
--- ^ 期待"STRING",}"获得未定义"
Error: Parse error on line 1: [{" product": [{"
---^ Expecting 'STRING', '}', got 'undefined'
这是代码:
[
{
"product" : [ { "code" : "Abc123", "description" : "Saw blade", "price" : 34.95 } ],
"vendor" : [ { "name" : "Acme Hardware", "state" : "New Jersey" } ]
},
{
"product" : [ { "code" : "Def456", "description" : "Hammer", "price" : 22.51 } ],
},
{
"product" : [ { "code" : "Ghi789", "description" : "Wrench", "price" : 12.15 } ],
"vendor" : [ { "name" : "Acme Hardware", "state" : "New Jersey" } ]
},
{
"product" : [ { "code" : "Jkl012", "description" : "Pliers", "price" : 14.54 } ],
"vendor" : [ { "name" : "Norwegian Tool Suppliers", "state" : "Kentucky" } ]
}
]
推荐答案
JSON字符串文字必须使用普通引号字符("
),而不是智能引号().
JSON string literals must use normal quote characters ("
), not smart quotes (""
).
这篇关于JSON解析错误:预期为"STRING"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文