2
这个JSON通过jsonlint验证。然而,Firefox和Chrome拒绝它:为什么这个JSON“无效?”
{
"messages": [
{
"subject": "One"
},
{
"subject": "Two"
},
{
"subject": "Three"
}
],
"totalResults": 10
}
错误消息是“消息”上的“无效标签”。
这是它是如何被加载:
var store = Ext.create('Ext.data.Store', {
model: 'MyModel',
autoLoad: true,
pageSize: 3,
proxy: {
type: 'jsonp',
url: 'http://localhost:8080/document-viewer-1.0/testdata.json',
reader: {
root: 'messages',
totalProperty: 'totalResults'
}
}
});
答:
这是我自己的愚蠢的错误。我没有将JSONP回调名称放在JSON文件结构中。
的JSON是有效的。 http://jsonlint.com – Gazler 2012-01-09 15:25:32