Sencha Touch:无法解析JSON树
问题描述:
我刚开始学习Sencha Touch。试图建立一个简单的新闻阅读器应用程序。但该应用程序无法解析提供的JSON。有人能帮我找到这个结构的错吗?Sencha Touch:无法解析JSON树
[{
'category': 'int',
'image': 'app/Views/images/img1.jpg',
'title': 'News title 1',
'date': '22 Oct 2011',
'desc': 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.',
'fullStory': 'Ut wisi enim ad minim veniam, quis nostrud.'},
{'category': 'nat',
'image': 'app/Views/images/img2.jpg',
'title': 'News title 2',
'date': '23 Oct 2011',
'desc': 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.',
'fullStory': 'Ut wisi enim ad minim veniam, quis nostrud.'}]
应用程序的模型&店如低于Safari浏览器返回
Ext.regModel('newsModel',{
fields:[
{ name: 'category', type: 'string'},
{ name: 'image', type: 'string'},
{ name: 'title', type: 'string'},
{ name: 'date', type: 'string'},
{ name: 'desc', type: 'string'},
{ name: 'fullStory', type: 'string'}
]});
AppName.newsStore = new Ext.data.TreeStore({
model: 'newsModel',
proxy: {
type: 'ajax',
url: 'app/Models/data/data.json',
reader:{
type: 'json'
}
}});
错误给出的是 - “Ext.data.JsonReader.getResponseData:无法解析JSON服务器返回的。”
答
尝试使用“或属性名称的字符。
它的工作!谢谢! –
只是附加的注释,使用http://jsonlint.com/检查您的JSON。这是过于精确,但如果它的工作原理在那里你可以得到Ext或任何其他的解析它。最大的不利因素是它需要“属性名称”。 – Asken
会做。再次感谢。 –